* 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:
parent
608f298ed9
commit
5692072d36
81 changed files with 1189 additions and 1351 deletions
|
|
@ -195,6 +195,40 @@ clixon_client_lock(int sock,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Internal function to construct the encoding and hello message
|
||||
*
|
||||
* @param[in] sock Socket
|
||||
* @param[in] namespace Default namespace used for non-prefixed entries in xpath. (Alt use nsc)
|
||||
* @param[in] xpath XPath
|
||||
* @param[out] xdata XML data tree (may or may not include the intended data)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
clixon_client_hello(int sock)
|
||||
{
|
||||
int retval = -1;
|
||||
cbuf *msg = NULL;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if ((msg = cbuf_new()) == NULL){
|
||||
clicon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
cprintf(msg, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
cprintf(msg, "<hello xmlns=\"%s\">", NETCONF_BASE_NAMESPACE);
|
||||
cprintf(msg, "<capabilities><capability>%s</capability></capabilities>", NETCONF_BASE_CAPABILITY_1_1);
|
||||
cprintf(msg, "</hello>");
|
||||
if (clicon_msg_send1(sock, msg) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||
if (msg)
|
||||
cbuf_free(msg);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Connect client to clixon backend according to config and return a socket
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] socktype Type of socket, internal/external/netconf/ssh
|
||||
|
|
@ -260,6 +294,9 @@ clixon_client_connect(clicon_handle h,
|
|||
if (clixon_proc_socket(argv, &cch->cch_pid, &cch->cch_socket) < 0){
|
||||
goto err;
|
||||
}
|
||||
/* Start with encoding and hello message */
|
||||
if (clixon_client_hello(cch->cch_socket) < 0)
|
||||
goto err;
|
||||
break;
|
||||
case CLIXON_CLIENT_SSH:
|
||||
break;
|
||||
|
|
@ -349,6 +386,7 @@ clixon_xml_bottom(cxobj *xtop,
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*! Internal function to construct a get-config and query a value from the backend
|
||||
*
|
||||
* @param[in] sock Socket
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue