Commit graph

199 commits

Author SHA1 Message Date
Olof hagsand
da2edceb7e * Added new functions: xml_tree_equal and xpath2xml
* RFC 8528 yang schema mount-points:
  * Made expand_dbvar and cli_dbxml mountpoint-aware (RFC 8528)
  * autocli supportgenerate
  * Made api_path2xml and xml2api_path mount-point-aware
  * Temporar fix in clixon_custom.h: XPATH_CANONICAL_SKIP_CHECK
* `xml2xpath()`: Added `apostrophe` as 4th parameter, default 0
* removed extra assert.h includes
2023-03-23 22:16:33 +01:00
Olof hagsand
5f2978d06c Files: Rearranged backend .h files: moved client_entry to clixon_backend_client.h 2023-03-03 16:05:31 +01:00
Olof hagsand
585823a609 Memory leaks 2023-02-14 16:42:43 +01:00
Olof hagsand
6681eb99d3 Netconf monitoring statistics frm RFC 6022 2023-02-04 17:13:45 +01:00
Olof hagsand
5da8ce211a Patch of previous commit: ca_reset plugin 2023-02-02 16:07:35 +01:00
Olof hagsand
3d64eddaf2 All calls to ca_reset plugin callback has db=tmp 2023-02-02 14:46:53 +01:00
Olof hagsand
a203f6cde7 Updated extraxml reset callback example and added a regression test 2023-02-02 12:17:52 +01:00
Olof hagsand
da9bfcbb53 * Changed debug levels in clicon_debug() to be based on maskable flags
* Added flag names: `CLIXON_DBG_*`
  * Added maskable flags that can be combined when debugging:
    * `DEFAULT` = 1: Basic debug message, espcially initialization
    * `MSG` = 2: Input and output packets, read datastore
    * `DETAIL` = 4: Details: message dump in hex, xpath parse trees, etc
    * `EXTRA` = 8: Extra detailed logs
* Test: some errors in yang-lib where content-id was in wrong place
2023-01-27 14:56:58 +01:00
Olof hagsand
923b998774 * Fixed: Initialized session-id to 1 instead of 0 following ietf-netconf.yang
* Clearer debug levels `clicon_debug()`:
  1: Logical debug message
  2: Input and output packets
  3: Message dump in hex, xpath parse trees
2023-01-18 15:51:31 +01:00
Olof hagsand
d84c529ff1 [Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)
* Applies to all c/h/y/l/sh files and .editorconfig
2022-10-27 14:21:17 +02:00
Olof hagsand
7976303ef2 Confirmed-commit handle drop privileges
Create and drop priv of rollback datastore on startup
Reverted xmldb to truncate instead of deleting datastores due to privileges drop
2022-10-26 14:39:47 +02:00
Olof hagsand
62e652bbcf Confirm-commit refactoring
Moved commit-confirm code to backend_confirm.c and removed (almost all) globals vars
2022-10-24 10:54:51 +02:00
Olof hagsand
11eccd5478 Confirm commit:
- Removed confirm-commit 1.0 capability (only 1.1 present)
- Made startup capability conditional (as confirmed-commit)
- Fixed startup error when rollback did not exist
- Adjust snmp commit calls
- Move failsafe to lib
- Test: Minimized test application, test capability
2022-10-07 16:04:31 +02:00
Phil Heller
8abcda6f85 confirmed-commit fixes, tests
- fixed typo preventing evaluation of confirmed-commit logic in backend_startup
- fixed uninitialized variable warnings
- added details to CHANGELOG.MD
- added capabilities advertisement for confirmed-commit 1.0 and 1.1
- added xml hello message that uses only eom framing, for simplicity in asynch tests
- add stty restore after wait_restconf to fix console corruption in tests
- adjust test_confirmed_commit to drop perms and run as the invoking user.  This will require running user to have permissions on /usr/local/var/example
- added CLI tests
2022-10-03 21:47:09 -06:00
Phil Heller
284316b646 Initial implementation of NETCONF confirmed-commit 2022-10-03 21:44:35 -06:00
Olof hagsand
eb8d0c0b3a SNMP frontend: added -z zap command-line option and pid-file exclusive check, fixed mem check 2022-06-26 11:28:42 +02:00
Olof hagsand
42f21a309a SNMP frontend: conflict typos, snmp pidfile 2022-06-26 11:28:42 +02:00
Olof hagsand
5551d753ef Logging fixes
* Fixed: [Error message seen twice in some cases](https://github.com/clicon/clixon/issues/325)
* Extended `-l` command-line option to all clixon commands with a `none` option, eg `-l n` directs logging to `dev/null`
2022-04-30 11:31:51 +02:00
Olof hagsand
ff37ce808c * Rename demon -> daemon 2022-03-07 11:18:27 +01:00
Olof hagsand
cf2de375f7 - Moved backend start message to after the clixon socket ops: create/bind/listen 2022-02-26 10:24:29 +01:00
Olof hagsand
78bdc4eaca Backend ignore of SIGPIPE. This occurs if client quits unexpectedly over the UNIX socket.
This is a timing issue but occurs more frequently in large RESTCONF messgaes.
2022-02-14 20:56:57 +01:00
Olof hagsand
6ae749c9dd * New clixon-config@2022-02-11.yang revision
* Added option: `CLICON_LOG_STRING_LIMIT`
2022-02-12 21:45:50 +01:00
Olof hagsand
77b4468eb3 Updated copyright statements to 2022 2022-01-18 16:36:00 +01:00
Olof hagsand
478911d0f5 * Changed typo configure --with-yang-standard-installdir to `configure --with-yang-standard-dir
* Updated command-line usage of cli,netconf,backend apps in sync with clixon-docs user manual
* Documented differences between protocol stubs for external vs internal netconf
2021-12-05 12:17:11 +01:00
Olof hagsand
b91ce762d5 * Performance improvement
* Added ancestor config cache indicating wether the node or an ancestor is config false or true
  * Improved yang cardinality lookup
* Added yang_init(), called from all apps using yang
2021-11-18 08:37:54 +01:00
Olof hagsand
edbbb43e1f Removed remaining and replaced pagination-mode with locked parameter
Dispatcher: Added dispatcher_free(), fixed mem-leaks and malloc return
checks
2021-10-10 11:40:47 +02:00
Olof hagsand
0c7f2043f3 * Pagination according to new draft
* count/skip -> limit/offset
* ietf-yang-metadata RFC 7952 support, placeholder parsing and extension
2021-09-21 11:22:41 +02:00
Olof hagsand
85e2945ec9 * Netconf message-id attribute changed from optional to mandatory
* Made NETCONF message handling more strict according to RFC 6241
  * Set `CLICON_NETCONF_MESSAGE_ID_OPTIONAL` to true to accept omission of message-id attribute
* Fixed: [need make sure message-id exist in rpc validate #240](https://github.com/clicon/clixon/issues/240)
2021-06-30 10:59:10 +02:00
Olof hagsand
dd8883420c * Made backend transaction and commit/validate API available to plugin code.
* This enables that RPOC handles can call commit and validate via lib
  * The commit/validate API is now: `candidate_validate()` and `candidate_commit()`
2021-06-17 19:20:27 +02:00
Olof hagsand
b40dafb691 * Event exit API changed to a single decrementing counter where 1 means exit.
* Removed: `clicon_exit_reset()`
  * Changed: `clicon_exit_set()` --> `clixon_exit_set(int nr)`
  * Changed: `clicon_exit_get()` --> `clixon_exit_get()`
* native restconf special case upgrade handling from http/1 -> http/2 and restconf restart: delay the restart using event exit counter
2021-06-16 11:58:13 +02:00
Olof hagsand
e0c3f5467c * Added new startup-mode: running-startup: First try running db, if it is empty try startup db.
* See [Can startup mode to be extended to support running-startup mode? #234](https://github.com/clicon/clixon/issues/234)
* Improved error message on failed MUST condition
2021-05-27 13:18:01 +02:00
Olof hagsand
c20c672d83 * Changed config and install options for Restconf
* clixon_restconf daemon is installed in /usr/local/sbin (as clixon_backend), instead of /www-data
    * `configure --with-wwwdir=<dir>` remains but only applies to fcgi socket and log
    * New option `CLICON_RESTCONF_INSTALL_DIR` is set to where clixon_restconf is installed, with default `/usr/local/sbin/`
  * Restconf drop privileges user is defined by `CLICON_RESTCONF_USER`
    * `configure --with-wwwuser=<user>` is removed
  * clixon_restconf drop of privileges is defined by `CLICON_RESTCONF_PRIVILEGES` option
* New clixon-restconf@2020-05-20.yang revision
  * Added: restconf `log-destination`
2021-05-23 17:14:18 +02:00
Olof hagsand
05009aed67 Add restconf get list extra =restval test 2021-04-28 11:31:41 +02:00
Olof hagsand
b88722fa25 - Restructure plugin module using a "module struct" rather than global variables.
This include plugin module init and exit functions
  New type: clixon_plugin_t exposed via public API while struct clixon_plugin is private
- Makefile changes for static linkage using "LINKAGE=static"
- Moved nacm external init to later stage in backend_main
2021-04-19 11:06:40 +02:00
Olof hagsand
8469a0962e * Add multiple yang support also for obsolete versions
* This means that files and datastores supporting modstate also looks for deleted or updated yang modules.
  * A stricter binding which gives error if loading outdated YANG file does not exist.
* Stricter yang checks: you cannot do get-config on datastores that have obsolete YANG
* Added xerr output parameter to `xmldb_get0()`
2021-04-12 12:42:26 +02:00
Olof hagsand
477059f33d Fixed again: [backend start resconf failed due to path string truncated #192](https://github.com/clicon/clixon/issues/192) 2021-03-24 12:23:00 +01:00
Olof hagsand
43db8dd5c5 Fixed: [state showing error in cli with CLICON_STREAM_DISCOVERY_RFC8040 #191](https://github.com/clicon/clixon/issues/191) 2021-03-18 10:41:08 +01:00
Olof hagsand
afdf6ffcf8 Fixed: [state showing error in cli with CLICON_STREAM_DISCOVERY_RFC8040 #191](https://github.com/clicon/clixon/issues/191) 2021-03-18 09:43:13 +01:00
Olof hagsand
fb9917e81e * Removed endtag parameter of clixon_xml_parse_file() 2021-03-15 13:24:27 +01:00
Olof hagsand
7762b10cbb * Changed signal handling
* Moved clixon-proc sigchild handling	from handler to clixon_events
2021-03-11 18:12:43 +01:00
Olof hagsand
b2f9c59a34 * Reverted blocked signal behavior introduced in 5.0.
* Introduced a delay before making process start/stop/restart processes for race conditions when configuring eg restconf
* For restconf `CLICON_BACKEND_RESTCONF_PROCESS`, restart restconf if restconf is edited.
2021-03-02 12:24:07 +01:00
Olof hagsand
0fe8acd301 wait.h->sys/wait.h, restconf_rpc wait in test 2021-02-26 11:50:15 +01:00
Olof hagsand
d5edd64257 If a signal handler runs during select() loop in clixon_event_loop() and unless the signal handler sets clixon_exit, the select will be restarted. 2021-02-25 22:35:13 +01:00
Olof hagsand
9840e248c6 * Augment target node check strict, instead of printing a warning, it will terminate with error.
* Fixed: [Augment that reference a submodule as target node fails #178](https://github.com/clicon/clixon/issues/178)
* Fixed a memory error that was reported in slack by Pawel Maslanka
  * The crash printout was: `realloc(): invalid next size Aborted`
2021-02-19 15:46:55 +01:00
Olof hagsand
710fc76887 * Restconf authentication callback (ca_auth) signature changed
* Not backward compatible: All uses of the ca-auth callback in restconf plugins must be changed
  * New version is: `int ca_auth(h, req, auth_type, authp, userp)`
    * where `auth_type` is the requested authentication-type (none, client-cert or user-defined)
    * `authp` is the returned authentication flag
    * `userp` is the returned associated authenticated user
    * and the return value is three-valued: -1: Error, 0: ignored, 1: OK
  * For more info see [clixon-docs](https://clixon-docs.readthedocs.io/en/latest/restconf.html)
* New clixon-restconf@2020-12-30.yang revision
2021-02-09 21:26:35 +01:00
Olof hagsand
40008f182e Fix restart of restconf processes 2021-02-01 10:44:50 +01:00
Olof hagsand
f65efa3e5e Add ca_reset plugin also when backend starts as -s none 2021-01-31 20:47:41 +01:00
Olof hagsand
f5f013c739 * Corrected client session handling to make internal IPC socket persistent
* Applies to cli/netconf/restconf/client-api code
  * Previous behaviour:
    * Close socket after each rpc, but now keeps the socket open until the client terminates
    * Kept locks over socket life-cycle, but according to RFC 6241 7.5 a lock should be relaeased when session ends
2021-01-27 15:07:27 +01:00
Olof hagsand
2d402b7ba5 Added validation of clixon-restconf.yang: server-key-path and server-cert-path must be present if ssl enabled. 2021-01-21 12:11:26 +01:00
Olof hagsand
96b50b88e8 Copyright 2021 2021-01-13 14:40:34 +01:00