diff --git a/configure b/configure index 3b797862..efbdb17e 100755 --- a/configure +++ b/configure @@ -623,6 +623,7 @@ ac_subst_vars='LTLIBOBJS LIBOBJS EGREP GREP +SSH_BIN LEXLIB LEX_OUTPUT_ROOT LEX @@ -4563,6 +4564,53 @@ if test "$LEX" = ":"; then as_fn_error $? "CLIXON does not find lex or flex." "$LINENO" 5 fi +# SSH binary path +# Extract the first word of "ssh", so it can be a program name with args. +set dummy ssh; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SSH_BIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SSH_BIN in + [\\/]* | ?:[\\/]*) + ac_cv_path_SSH_BIN="$SSH_BIN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SSH_BIN="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +SSH_BIN=$ac_cv_path_SSH_BIN +if test -n "$SSH_BIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SSH_BIN" >&5 +$as_echo "$SSH_BIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +cat >>confdefs.h <<_ACEOF +#define SSH_BIN $SSH_BIN +_ACEOF + + # Get "bison" from bison -y or other string if test "$YACC" = "${YACC##bison}" ; then as_fn_error $? "CLIXON does not find bison. There are several problems with yacc and byacc. Please install bison. YACC=\"$YACC\"" "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 461b0fee..803eccc3 100644 --- a/configure.ac +++ b/configure.ac @@ -117,7 +117,7 @@ AC_SUBST(LINKAGE) AC_SUBST(with_restconf) # Set to native or fcgi -> compile apps/restconf AC_SUBST(enable_netsnmp) # Enable build of apps/snmp AC_SUBST(HAVE_LIBNGHTTP2,false) # consider using neutral constant such as with-http2 -AC_SUBST(HAVE_HTTP1,false) +AC_SUBST(HAVE_HTTP1,false) AC_SUBST(with_libxml2) AC_SUBST(CLIXON_YANG_PATCH) # Where Clixon installs its YANG specs @@ -147,6 +147,10 @@ if test "$LEX" = ":"; then AC_MSG_ERROR(CLIXON does not find lex or flex.) fi +# SSH binary path +AC_PATH_PROG(SSH_BIN, ssh) +AC_DEFINE_UNQUOTED(SSH_BIN, $SSH_BIN, [SSH binary]) + # Get "bison" from bison -y or other string if test "$YACC" = "${YACC##bison}" ; then AC_MSG_ERROR(CLIXON does not find bison. There are several problems with yacc and byacc. Please install bison. YACC="$YACC") diff --git a/docker/main/README.md b/docker/main/README.md index 5d3c4aef..d71d4884 100644 --- a/docker/main/README.md +++ b/docker/main/README.md @@ -47,7 +47,7 @@ As CLI: ``` As netconf via stdin/stdout: ``` - $ sudo docker exec -it clixon-system clixon_netconf + $ sudo docker exec -it clixon-system clixon_netconf -f /usr/local/etc/example.xml ``` As restconf using curl on exposed port 80: ``` diff --git a/example/main/README.md b/example/main/README.md index 0175052f..2b8d820b 100644 --- a/example/main/README.md +++ b/example/main/README.md @@ -13,7 +13,6 @@ * [Systemd](#systemd) * [Docker](#docker) * [Plugins](#plugins) - ## Background diff --git a/include/clixon_config.h.in b/include/clixon_config.h.in index 02f01bdf..4b0e6cd1 100644 --- a/include/clixon_config.h.in +++ b/include/clixon_config.h.in @@ -153,6 +153,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* SSH binary */ +#undef SSH_BIN + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/lib/clixon/clixon_proto.h b/lib/clixon/clixon_proto.h index 3304d345..15c69bf4 100644 --- a/lib/clixon/clixon_proto.h +++ b/lib/clixon/clixon_proto.h @@ -53,7 +53,7 @@ enum format_enum{ /* Protocol message header */ struct clicon_msg { - uint32_t op_len; /* length of message. network byte order. */ + uint32_t op_len; /* length of whole message: body+header, network byte order. */ uint32_t op_id; /* session-id. network byte order. */ char op_body[0]; /* rest of message, actual data */ }; diff --git a/test/config.sh.in b/test/config.sh.in index 9f8561c6..d6ff7fef 100755 --- a/test/config.sh.in +++ b/test/config.sh.in @@ -96,3 +96,5 @@ YANG_STANDARD_DIR=@YANG_STANDARD_DIR@ YANG_INSTALLDIR=@YANG_INSTALLDIR@ MIB_GENERATED_YANG_DIR=@MIB_GENERATED_YANG_DIR@ + +SSH_BIN=@SSH_BIN@ diff --git a/test/test_netconf_ssh_callhome.sh b/test/test_netconf_ssh_callhome.sh index 050fbcee..a52e57f6 100755 --- a/test/test_netconf_ssh_callhome.sh +++ b/test/test_netconf_ssh_callhome.sh @@ -4,8 +4,10 @@ # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi -# Skip it if no openssh -if ! [ -x "$(command -v ssh)" ]; then +ssh_bin=${SSH_BIN} + +# Skip it if no ssh bin +if ! [ -x "$ssh_bin" ]; then echo "...ssh not installed" rm -rf $dir if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip @@ -142,9 +144,9 @@ HashKnownHosts no EOF new "Start Listener client" -echo "ssh -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand=\"clixon_netconf_ssh_callhome_client -a 127.0.0.1\" . netconf" +echo "${ssh_bin} -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand=\"clixon_netconf_ssh_callhome_client -a 127.0.0.1\" . netconf" #-F $sshcfg -expectpart "$(ssh -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand="${clixon_netconf_ssh_callhome_client} -a 127.0.0.1" . netconf < $rpccmd)" 0 "urn:ietf:params:netconf:base:1.1.*2" "" +expectpart "$(${ssh_bin} -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand="${clixon_netconf_ssh_callhome_client} -a 127.0.0.1" . netconf < $rpccmd)" 0 "urn:ietf:params:netconf:base:1.1.*2" "" # Wait wait diff --git a/test/test_with_default.sh b/test/test_with_default.sh index 423db538..e207ef7b 100755 --- a/test/test_with_default.sh +++ b/test/test_with_default.sh @@ -8,7 +8,7 @@ # o explicit # Clixon supports explicit, but the testcases define the other cases as well # in case others will be supported -# XXX I dont think this is correct. Or at least it is not complete. +# See test_yang_with_default for full RFC6243 tests # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi