* Implementation of "chunked framing" according to RFC6242 for Netconf 1.1.

* First hello is 1.0 EOM framing, then successing rpc is chunked framing
  * See
    * [Netconf framing](https://github.com/clicon/clixon/issues/50), and
    * [Clixon does not switch to chunked framing after NETCONF 1.1 is negotiated](https://github.com/clicon/clixon/issues/314)
* C:
  * Moved netconf framing code from netconf application to clixon lib
* Test:
  * New expecteof_netconf and adjusted other expect scripts to handle NETCONF 1.1 framing
This commit is contained in:
Olof hagsand 2022-03-27 17:39:24 +02:00
parent bf983d7ca4
commit c038c9a27f
95 changed files with 1758 additions and 1208 deletions

View file

@ -75,6 +75,7 @@
#include "clixon_sig.h"
#include "clixon_xml.h"
#include "clixon_xml_io.h"
#include "clixon_netconf_lib.h"
#include "clixon_options.h"
#include "clixon_proto.h"
@ -427,7 +428,7 @@ clicon_msg_rcv(int s,
/*! Receive a message using plain NETCONF
*
* @param[in] s socket (unix or inet) to communicate with backend
* @param[out] cb1 cligen buf struct containing the incoming message
* @param[out] cb cligen buf struct containing the incoming message
* @param[out] eof Set if eof encountered
* @see netconf_input_cb()
* @see clicon_msg_rcv using IPC message struct
@ -499,7 +500,6 @@ clicon_msg_send1(int s,
{
int retval = -1;
cprintf(cb, "]]>]]>");
if (atomicio((ssize_t (*)(int, void *, size_t))write,
s, cbuf_get(cb), cbuf_len(cb)+1) < 0){
clicon_err(OE_CFG, errno, "atomicio");
@ -667,6 +667,10 @@ clicon_rpc1(int sock,
int retval = -1;
clicon_debug(1, "%s", __FUNCTION__);
if (netconf_framing_preamble(NETCONF_SSH_CHUNKED, msg) < 0)
goto done;
if (netconf_framing_postamble(NETCONF_SSH_CHUNKED, msg) < 0)
goto done;
if (clicon_msg_send1(sock, msg) < 0)
goto done;
if (clicon_msg_rcv1(sock, msgret, eof) < 0)