From e4834b989668e9d4e95f6a31104abeb2df1cff59 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Tue, 27 Feb 2024 13:22:50 +0100 Subject: [PATCH] NETCONF internal: Enable RFC 6242 chunked encoding --- include/clixon_custom.h | 2 +- lib/src/clixon_netconf_input.c | 2 +- lib/src/clixon_netconf_lib.c | 2 +- lib/src/clixon_proto.c | 20 ++++++++++++-------- test/test_sock.sh | 10 ++++++++++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 3f9bf4dd..90f202b5 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -213,5 +213,5 @@ * Following things NYI: * - Emulates old clicon_msg API */ -#undef NETCONF_INPUT_UNIFIED_INTERNAL +#define NETCONF_INPUT_UNIFIED_INTERNAL diff --git a/lib/src/clixon_netconf_input.c b/lib/src/clixon_netconf_input.c index 0d3ee2bb..528ba914 100644 --- a/lib/src/clixon_netconf_input.c +++ b/lib/src/clixon_netconf_input.c @@ -124,7 +124,7 @@ netconf_input_read2(int s, * @param[in,out] frame_size Chunked framing size parameter * @param[out] eom If frame found in cb? * @retval 0 OK - * @retval -1 Error + * @retval -1 Error (from chunked framing) * The routine should be called continuously with more data from input socket in buf * State of previous reads is saved in: * - bufp/lenp diff --git a/lib/src/clixon_netconf_lib.c b/lib/src/clixon_netconf_lib.c index 44039fea..8d385232 100644 --- a/lib/src/clixon_netconf_lib.c +++ b/lib/src/clixon_netconf_lib.c @@ -2226,7 +2226,7 @@ netconf_output_encap(netconf_framing_type framing, * @retval 2 End-of-frame * @retval 1 Chunk-data * @retval 0 Framing char, not data - * @retval -1 Error + * @retval -1 Framing error * Example: C: \n#4\n C: " "4" + if [ $family = UNIX -a -n "$netcat" ]; then + new "Unix socket garbage test" + echo "garbage" | netcat -U $sock + + new "Check backend alive" + pid=$(pgrep -u root -f clixon_backend) + if [ -z "$pid" ]; then + err "backend pid" "backend dead" + fi + fi if [ $BE -ne 0 ]; then new "Kill backend" # Check if premature kill