From ecd5f7de70200d3132f00e5ffdfd74cb22c33e22 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 22 Apr 2021 13:45:02 +0200 Subject: [PATCH] * Add default network namespace constant: `RESTCONF_NETNS_DEFAULT` with default value "default". --- CHANGELOG.md | 6 +++++- apps/restconf/restconf_lib.c | 2 +- include/clixon_custom.h | 4 ++++ test/cicd/coverage.sh | 2 +- test/config.sh.in | 2 +- yang/clixon/clixon-restconf@2021-03-15.yang | 3 ++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3f1fb21..3cd99b1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ ## 5.2.0 Expected: June 2021 +### Minor features + +* Add default network namespace constant: `RESTCONF_NETNS_DEFAULT` with default value "default". + ## 5.1.0 15 April 2021 @@ -181,7 +185,7 @@ Users may have to change how they access the system * Follows RFC 6241 7.5 closer * Previous behavior: * Close socket after each rpc - * Release lockwhen socket closes (after each rpc) + * Release lock when socket closes (after each rpc) * New behavior * Keep socket open until the client terminates, not close after each RPC * Release lock until session (not socket) ends diff --git a/apps/restconf/restconf_lib.c b/apps/restconf/restconf_lib.c index f3e4a31a..46abe635 100644 --- a/apps/restconf/restconf_lib.c +++ b/apps/restconf/restconf_lib.c @@ -671,7 +671,7 @@ restconf_socket_init(const char *netns0, clicon_debug(1, "%s %s %s %s %hu", __FUNCTION__, netns0, addrtype, addrstr, port); /* netns default -> NULL */ - if (netns0 != NULL && strcmp(netns0, "default")==0) + if (netns0 != NULL && strcmp(netns0, RESTCONF_NETNS_DEFAULT)==0) netns = NULL; else netns = netns0; diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 08fa1031..a0ff95da 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -89,3 +89,7 @@ * Consider making this an option or configure option */ #define DATASTORE_TOP_SYMBOL "config" + +/* Name of default netns for clixon-restconf.yang socket/namespace field + */ +#define RESTCONF_NETNS_DEFAULT "default" diff --git a/test/cicd/coverage.sh b/test/cicd/coverage.sh index 5729c4bb..f64181a7 100755 --- a/test/cicd/coverage.sh +++ b/test/cicd/coverage.sh @@ -26,5 +26,5 @@ find . -name "*.gcda" | xargs sudo chmod 777 #GITHUB_SHA= # Push upstream # The -f dont seem to work -bash <(curl -s https://codecov.io/bash) -f '!clixon_util*' -f '!example' -t ${TOKEN} +bash <(curl -s https://codecov.io/bash) -t ${TOKEN} diff --git a/test/config.sh.in b/test/config.sh.in index 0dd198c8..db88b2a9 100755 --- a/test/config.sh.in +++ b/test/config.sh.in @@ -69,7 +69,7 @@ DATASTORE_TOP="config" # clixon yang revisions occuring in tests CLIXON_LIB_REV="2021-03-08" CLIXON_CONFIG_REV="2021-03-08" -CLIXON_RESTCONF_REV="2021-03-08" +CLIXON_RESTCONF_REV="2021-03-15" CLIXON_EXAMPLE_REV="2020-12-01" # Length of TSL RSA key diff --git a/yang/clixon/clixon-restconf@2021-03-15.yang b/yang/clixon/clixon-restconf@2021-03-15.yang index ef0604da..7180054a 100644 --- a/yang/clixon/clixon-restconf@2021-03-15.yang +++ b/yang/clixon/clixon-restconf@2021-03-15.yang @@ -189,7 +189,8 @@ module clixon-restconf { type string; description "Network namespace. - On platforms where namespaces are not suppported, always 'default'"; + On platforms where namespaces are not suppported, 'default' + Default value can be changed by RESTCONF_NETNS_DEFAULT"; } leaf address { type inet:ip-address;