* Fixed: [CLIXON is not waiting for the hello message #184](https://github.com/clicon/clixon/issues/184)

* Hello message semantics has been made stricter according to RFC 6241 Sec 8.1, for example:
  * A client MUST send a <hello> element.
  * Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.1" (or 1.0 for RFC 4741)
  * The netconf client will terminate (close the socket) if the client does not comply
  * You can set `CLICON_NETCONF_HELLO_OPTIONAL` to true to use the old behavior of essentially ignoring hellos.
* New clixon-config@2020-03-08.yang revision
  * Added: `CLICON_NETCONF_HELLO_OPTIONAL`
* The base capability has been changed to "urn:ietf:params:netconf:base:1.1" following RFC6241.
This commit is contained in:
Olof hagsand 2021-03-10 13:56:53 +01:00
parent 608f298ed9
commit 5692072d36
81 changed files with 1189 additions and 1351 deletions

View file

@ -543,8 +543,38 @@ xml_bind_yang_rpc(cxobj *xrpc,
cxobj *xc;
opname = xml_name(xrpc);
if ((strcmp(opname, "hello")) == 0) /* Hello: dont bind, dont appear in any yang spec */
if ((strcmp(opname, "hello")) == 0){
/* Hello: dont bind, dont appear in any yang spec, just ensure there is nothing apart from
* session-id or capabilities/capability tags
* If erro, just log, drop and close, rpc-error should not be sent since it is not rpc
*/
x = NULL;
while ((x = xml_child_each(xrpc, x, CX_ELMNT)) != NULL) {
name = xml_name(x);
if (strcmp(name, "session-id") == 0)
continue;
else if (strcmp(name, "capabilities") == 0){
xc = NULL;
while ((xc = xml_child_each(x, xc, CX_ELMNT)) != NULL) {
if (strcmp(xml_name(xc), "capability") != 0){
if (xerr &&
netconf_unknown_element_xml(xerr, "protocol", xml_name(xc),
"Unrecognized hello/capabilities element") < 0)
goto done;
goto fail;
}
}
}
else {
if (xerr &&
netconf_unknown_element_xml(xerr, "protocol", name, "Unrecognized hello element") < 0)
goto done;
clicon_err(OE_XML, EFAULT, "Unrecognized hello element: %s", name);
goto fail;
}
}
goto ok;
}
else if ((strcmp(opname, "notification")) == 0)
goto ok;
else if ((strcmp(opname, "rpc")) == 0)