Commit graph

649 commits

Author SHA1 Message Date
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
c509868345 Look for symbols in plugins using instead of for more portable use 2021-02-25 21:59:33 +01:00
Olof hagsand
84ac4a1e49 modified CHANGELOG for 5.0, improved some logs 2021-02-25 21:58:57 +01:00
Olof hagsand
3d07db24d9 * Added CLICON_ANONYMOUS_USER to clicon-config.yang
* evhtp restconf closes session on -1 fatal error (no hang)
* restconf auth-type=none call ca_auth callback
* main example for auth_type=none uses basic auth to get user but without passwd check
2021-02-21 14:48:12 +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
108f94cfad * Fixed: [Irregular ordering of cli command + help text when integer is a part of command #176](https://github.com/clicon/clixon/issues/176)
* Enabled by default `cligen_lexicalorder_set()` using strversmp instead of strcmp
2021-02-17 13:34:56 +01:00
Olof hagsand
a129756c6c Fixed: [Is there an error with plugin's ca_interrupt setting ? #173](https://github.com/clicon/clixon/issues/173) 2021-02-15 12:54:09 +01:00
Olof Hagsand
d1e5599572 reorder clixon-restconf.yang and some test fixes 2021-02-14 14:48:52 +00:00
Olof hagsand
c64878fd4a * RESTCONF configuration is unified and moved from clixon-config.yang to clixon-restconf.yang
* Except `CLICON_RESTCONF_DIR` which remains in clixon-config.yang due to bootstrapping
    * -d <dir> option removed
  * This applies to both evhtp and fcgi RESTCONF
    * Both can also read config from backend, and be started from backend
  * You may need to move config as follows (from clixon-config.yang to clixon-restconf.yang)
    * CLICON_RESTCONF_PRETTY -> restconf/pretty
    * CLICON_RESTCONF_PATH -> restconf/fcgi-path
2021-02-11 13:46:34 +01:00
Olof hagsand
72dd31395e fixed tests after updates 2021-02-10 20:48:57 +01:00
Olof hagsand
6b08a22f04 * RESTCONF failed authentication changed error return code from 403 Forbiden to 401 Unauthorized following RFC 8040 2021-02-10 14:17:34 +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
1f0147f996 removed unnecessary strerror() in clixon_err() calls; added 'function' keyword in all function declarations in the test scripts 2021-02-04 12:04:48 +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
200e258ded mv stream->restconf_notif, cli-auto test change for grouping/extension bug 2021-01-28 11:27:07 +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
b41f68b677 debug print of backend state, split test-stream into a netconf and restconf part, change restconf yang auth-type from leaf-list to leaf 2021-01-27 14:40:34 +01:00
Olof hagsand
a5f32fbedf * Restconf evhtp using network namespaces implemented 2021-01-26 17:33:24 +01:00
Olof hagsand
68371d4fc5 upgrade copyright, aux tools, etc 2021-01-21 12:23:46 +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
Olof hagsand
2a392ca0e9 * rpc msg C API rearranged to separate socket/connect from connect 2021-01-12 14:03:07 +01:00
Olof hagsand
8cde7a4ded * Handling empty netconf XML messages "]]>]]>" is changed from being accepted to return an error.
* Netconf split lines input (input fragments) fixed
  * Netconf input split on several lines, eg using stdin: "<a>\nfoo</a>]]>]]>" could under some circumstances be split so that only "</a>]]>]]>" be properly processed. This could also happen to a socket receiving a sub-string and then after a delay receive the rest.
  * Fixed by storing residue and add that to the input string if later input is received on the same socket.
* Use [https://github.com/clicon/libevhtp](https://github.com/clicon/libevhtp) instead of [https://github.com/criticalstack/libevhtp](https://github.com/criticalstack/libevhtp) as a source of the evhtp source
2021-01-07 16:57:47 +01:00
Olof hagsand
cf63d0f761 * New clixon-config@2020-12-30.yang revision
* New clixon-lib@2020-12-30.yang revision
* Added callback to process-control RPC feature in clixon-lib.yang to manage processes
* Changed behavior of starting restconf internally using `CLICON_BACKEND_RESTCONF_PROCESS` monitoring changes in enable flag, not only the RPC.
* Changed: RPC process-control output parameter status to pid
2021-01-02 17:27:44 +01:00
Olof hagsand
7459925bd0 Limited fuzz by AFL committed, see [fuzz/README.md](fuzz/README.md) for details 2020-12-29 18:29:06 +01:00
Olof hagsand
96ab7292b9 * Added cvv_i output parameter to api_path_fmt2api_path() to see how many cvv entries were used
* CLIspec dbxml API: Ability to specify deletion of _any_ vs _specific_ entry.
2020-12-29 11:14:34 +01:00
Olof hagsand
eaedb14918 Prepare for 4.9.0 release 2020-12-18 13:54:00 +01:00
Olof hagsand
b8f5d1dcae * Added CLICON_BACKEND_RESTCONF_PROCESS to clixon-config.yang 2020-12-17 12:13:06 +01:00
Olof Hagsand
4fe3486d4e
Merge pull request #162 from s-bauer/patch-2
Fixed filter-namespace not recognized correctly
2020-12-16 16:22:29 +01:00
Olof hagsand
22adc58187 * New process-control RPC feature in clixon-lib.yang to manage processes
* This is an alternative to manage a clixon daemon via sudtemd, containerd or other
  * One important special case is starting the clixon-restconf daemon internally
  * This is how it works:
    * Register a process via `clixon_process_register(h, name, namespace, argv, argc)`
    * Use process-control RPC defined in clixon-lib.yang to start/stop/restart or query status on that process
  * Example code in the main example
2020-12-15 15:48:42 +01:00
Olof hagsand
8540820698 * New clixon-lib@2020-12-08.yang revision
* Added: autocli-op extension (see new features)
  * Added: rpc process-control for process/daemon management
* Added enable flag and removed presence in clixon-restconf
2020-12-13 22:19:25 +01:00
Simon Bauer
638658c63d
Update netconf_rpc.c 2020-12-13 18:07:28 +01:00
Simon Bauer
be329dac6d
Fixed filter namespace in netconf_rpc.o
The "filter" node was not detected when an a namespace was used. The fix is similar to d045e8abce and related to bug #154 #143
2020-12-13 18:05:49 +01:00
Olof hagsand
d6db28c47a Fixed memory error in RESTCONF PATCH/PUT when accessing top-level data node. 2020-12-09 13:39:38 +01:00
Olof hagsand
b8641f30bd * More YANG extension functionality,
* See [Augment auto-cli for hiding/modifying cli syntax #156](https://github.com/clicon/clixon/issues/156) and [hiding auto-generated CLI entries #153](https://github.com/clicon/clixon/issues/153)
  * Extensions can be used in augmentations
  * Extension `autocli-op` has been added to add "hidden" commands in the autocli
  * Documentation: https://clixon-docs.readthedocs.io/en/latest/misc.html#extensions
2020-12-08 17:21:37 +01:00
Olof hagsand
e1b94d94d2 * Ensure all fopen check for NULL (not -1)
* Improve test-perf cycles
2020-12-07 13:33:21 +01:00
Olof Hagsand
344dcacf6f * Second fix of https://github.com/clicon/clixon/issues/158
* Actually there is an error of duplicate rpc-replies, but it should be detected in the backend not here
2020-12-06 11:22:26 +00:00
Olof hagsand
3c014184f7 * Fixed: [ Calling copy-config RPC from restconf #158](https://github.com/clicon/clixon/issues/158) 2020-12-05 17:36:21 +01:00
Olof hagsand
a71e8aaceb * minor edits make datastore=nocache pass tests, and ensure generic copy-config works 2020-12-04 14:47:55 +01:00
Olof hagsand
d045e8abce * Fixed: [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* edit-config "config" parameter did not work with prefix other than null
2020-12-02 14:21:17 +01:00
Olof hagsand
6810472a42 * Fixed typo: [False Header Content_type in restconf error #152](https://github.com/clicon/clixon/issues/152) 2020-12-01 12:58:07 +01:00
Olof hagsand
c32950c8a9 * Added message-id attributes in error and hello replies
* See [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* Removed mandatory loading of clixon_restconf.yang
2020-12-01 12:14:30 +01:00
Olof hagsand
19fb063f82 Support for building static lib: 2020-11-29 17:00:35 +01:00
Olof hagsand
542c0495b3 autocli sub fixes 2020-11-28 18:17:32 +01:00
Olof hagsand
75f85e0253 revert yang2cli sub code, use existing yang2cli solution 2020-11-27 15:31:27 +01:00
Olof hagsand
dda3244252 * Auto-cli changed singature of yang2cli()
* Auto-cli: create generated CLI for sub-parts of a YANG spec
2020-11-26 17:32:09 +01:00
Olof hagsand
0b948248e4 * Reworked evhtp restconf config to only use clixon-restconf.yang and marked local restconf options as obsolete
* Extended clicon-config with clixon-restconf for local config
* Removed obsolete CLICON_TRANSACTION_MOD
2020-11-21 13:16:29 +01:00
Olof hagsand
3d10c3bfcb evhtp debugging: memleaks, test errors, etc 2020-11-19 18:06:20 +01:00