Added --with-config-compat and --with-startup-compat to configure
This commit is contained in:
parent
96a7ec86f0
commit
2ebd89d636
7 changed files with 104 additions and 27 deletions
19
CHANGELOG.md
19
CHANGELOG.md
|
|
@ -14,22 +14,31 @@ SUNET for support, requests, debugging, bugfixes and proposed solutions.
|
|||
* Netconf client was limited to 8K byte messages. New limit is 2^32 bytes.
|
||||
|
||||
* XML and YANG-based configuration file.
|
||||
* New configuration files have .xml suffix, old have .conf. Old config files till work for backward compatibility.
|
||||
* New configuration files have .xml suffix, old have .conf.
|
||||
* The yang model is yang/clixon-config.yang.
|
||||
* A migration utility is clixon_cli -x to print new format, eg:
|
||||
```
|
||||
clixon_cli -f /usr/local/etc/routing.conf -1x
|
||||
clixon_cli -f /usr/local/etc/routing.conf -1x
|
||||
```
|
||||
* Backward compatibility is enabled:
|
||||
```
|
||||
configure --with-config-compat
|
||||
```
|
||||
* Both .xml and .conf works in backward compatible mode.
|
||||
|
||||
* Introducing backend daemon startup modes.
|
||||
* Simplified backend daemon startup modes.
|
||||
* The flags -IRCr are replaced with command-line option -s <mode>
|
||||
* You use the -s to select the mode: `clixon_backend ... -s running`
|
||||
* You may also add a default method in the configuration file: `<CLICON_STARTUP_MODE>init</CLICON_STARTUP_MODE>`
|
||||
* The option CLICON_USE_STARTUP_CONFIG is obsoleted by "startup" mode
|
||||
* The configuration option CLICON_USE_STARTUP_CONFIG is obsolete
|
||||
* -I replace with -s "init" (or use of CLICON_STARTUP_MODE option)
|
||||
* -CIr replace with -s "running"
|
||||
* (no-option) replace with -s "none"
|
||||
* Backward compatibility is enabled by defining BACKEND_STARTUP_BACKWARD_COMPAT in include/clixon_custom.h
|
||||
* Backward compatibility is enabled by:
|
||||
```
|
||||
configure --with-startup-compat
|
||||
```
|
||||
* Both -CIr and -s works in backward compatible mode.
|
||||
|
||||
* Extra XML has been added along with the new startup modes. Requested by Netgate.
|
||||
* You can add extra XML with the -c option to the backend daemon on startup:
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
#include "backend_handle.h"
|
||||
|
||||
/* Command line options to be passed to getopt(3) */
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
#define BACKEND_OPTS "hD:f:d:b:Fzu:P:1s:c:IRCrg:py:x:" /* substitute s: for IRCc:r */
|
||||
#else
|
||||
#define BACKEND_OPTS "hD:f:d:b:Fzu:P:1s:c:g:py:x:" /* substitute s: for IRCc:r */
|
||||
|
|
@ -142,12 +142,12 @@ usage(char *argv0, clicon_handle h)
|
|||
" -P <file>\tPid filename (default: %s)\n"
|
||||
" -s <mode>\tSpecify backend startup mode: none|startup|running|init (replaces -IRCr\n"
|
||||
" -c <file>\tLoad extra xml configuration, but don't commit.\n"
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
" -I\t\tInitialize running state database\n"
|
||||
" -R\t\tCall plugin_reset() in plugins to reset system state in running db (use with -I)\n"
|
||||
" -C\t\tCall plugin_reset() in plugins to reset system state in candidate db (use with -I)\n"
|
||||
" -r\t\tReload running database\n"
|
||||
#endif /* BACKEND_STARTUP_BACKWARD_COMPAT */
|
||||
#endif /* BACKEND_STARTUP_COMPAT */
|
||||
" -p \t\tPrint database yang specification\n"
|
||||
" -g <group>\tClient membership required to this group (default: %s)\n"
|
||||
" -y <file>\tOverride yang spec file (dont include .yang suffix)\n"
|
||||
|
|
@ -271,7 +271,7 @@ plugin_start_useroptions(clicon_handle h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
/*! Initialize running-config from file application configuration
|
||||
*
|
||||
* @param[in] h clicon handle
|
||||
|
|
@ -424,7 +424,7 @@ fragmented_startup_mode(clicon_handle h,
|
|||
done:
|
||||
return retval;
|
||||
}
|
||||
#endif /* BACKEND_STARTUP_BACKWARD_COMPAT */
|
||||
#endif /* BACKEND_STARTUP_COMPAT */
|
||||
|
||||
/*! Merge xml in filename into database
|
||||
*/
|
||||
|
|
@ -599,7 +599,7 @@ main(int argc, char **argv)
|
|||
int foreground;
|
||||
int once;
|
||||
enum startup_mode_t startup_mode;
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
int init_rundb = 0;
|
||||
int reset_state_running = 0;
|
||||
int reset_state_candidate = 0;
|
||||
|
|
@ -718,7 +718,7 @@ main(int argc, char **argv)
|
|||
case 'c': /* Load application config */
|
||||
extraxml_file = optarg;
|
||||
break;
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
case 'I': /* Initiate running db */
|
||||
init_rundb++;
|
||||
break;
|
||||
|
|
@ -731,7 +731,7 @@ main(int argc, char **argv)
|
|||
case 'r': /* Reload running */
|
||||
reload_running++;
|
||||
break;
|
||||
#endif /* BACKEND_STARTUP_BACKWARD_COMPAT */
|
||||
#endif /* BACKEND_STARTUP_COMPAT */
|
||||
case 'g': /* config socket group */
|
||||
clicon_option_str_set(h, "CLICON_SOCK_GROUP", optarg);
|
||||
break;
|
||||
|
|
@ -832,7 +832,7 @@ main(int argc, char **argv)
|
|||
/* If startup mode is not defined, eg via OPTION or -s, assume old method */
|
||||
startup_mode = clicon_startup_mode(h);
|
||||
if (startup_mode == -1){ /* Old style, fragmented mode, phase out */
|
||||
#ifdef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
#ifdef BACKEND_STARTUP_COMPAT
|
||||
if (fragmented_startup_mode(h,
|
||||
argv0, argc, argv,
|
||||
reload_running, init_rundb,
|
||||
|
|
|
|||
44
configure
vendored
44
configure
vendored
|
|
@ -632,6 +632,8 @@ CPP
|
|||
OBJEXT
|
||||
EXEEXT
|
||||
ac_ct_CC
|
||||
with_config_compat
|
||||
with_startup_compat
|
||||
with_keyvalue
|
||||
with_restconf
|
||||
RANLIB
|
||||
|
|
@ -708,6 +710,8 @@ with_cligen
|
|||
with_restconf
|
||||
with_keyvalue
|
||||
with_qdbm
|
||||
with_startup_compat
|
||||
with_config_compat
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
|
|
@ -1346,6 +1350,8 @@ Optional Packages:
|
|||
--without-restconf disable support for restconf
|
||||
--with-keyvalue enable support for key-value xmldb datastore
|
||||
--with-qdbm=dir Use QDBM here, if keyvalue
|
||||
--with-startup-compat Backward compatibility of backend startup commands
|
||||
--with-config-compat Backward compatibility of ocnfiguration file
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
|
|
@ -2341,6 +2347,8 @@ test -n "$target_alias" &&
|
|||
|
||||
# If yes, compile apps/restconf
|
||||
# If yes, compile datastore/keyvalue
|
||||
# If yes, backward compatible backend startup
|
||||
# If yes, backward compatible .conf configuration
|
||||
|
||||
#
|
||||
ac_ext=c
|
||||
|
|
@ -3946,9 +3954,7 @@ else
|
|||
with_keyvalue=no
|
||||
fi
|
||||
|
||||
echo "keyvalue:${with_keyvalue}"
|
||||
if test "x${with_keyvalue}" == xyes; then
|
||||
echo "yes keyvalue"
|
||||
# This is for qdbm
|
||||
|
||||
# Check whether --with-qdbm was given.
|
||||
|
|
@ -4038,6 +4044,40 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
# This is for backward compatibility of backend startup commands
|
||||
|
||||
# Check whether --with-startup_compat was given.
|
||||
if test "${with_startup_compat+set}" = set; then :
|
||||
withval=$with_startup_compat;
|
||||
else
|
||||
with_startup_compat=no
|
||||
fi
|
||||
|
||||
if test "x${with_startup_compat}" == xyes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define BACKEND_STARTUP_COMPAT $with_startup_compat
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
# This is for backward compatibility of .conf configuration file
|
||||
|
||||
# Check whether --with-config_compat was given.
|
||||
if test "${with_config_compat+set}" = set; then :
|
||||
withval=$with_config_compat;
|
||||
else
|
||||
with_config_compat=no
|
||||
fi
|
||||
|
||||
if test "x${with_config_compat}" == xyes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define CONFIG_COMPAT $with_config_compat
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
|
||||
$as_echo_n "checking for crypt in -lcrypt... " >&6; }
|
||||
if ${ac_cv_lib_crypt_crypt+:} false; then :
|
||||
|
|
|
|||
22
configure.ac
22
configure.ac
|
|
@ -80,6 +80,8 @@ AC_SUBST(AR)
|
|||
AC_SUBST(RANLIB)
|
||||
AC_SUBST(with_restconf) # If yes, compile apps/restconf
|
||||
AC_SUBST(with_keyvalue) # If yes, compile datastore/keyvalue
|
||||
AC_SUBST(with_startup_compat) # If yes, backward compatible backend startup
|
||||
AC_SUBST(with_config_compat) # If yes, backward compatible .conf configuration
|
||||
|
||||
#
|
||||
AC_PROG_CC()
|
||||
|
|
@ -141,9 +143,7 @@ AC_ARG_WITH([keyvalue],
|
|||
[AS_HELP_STRING([--with-keyvalue],[enable support for key-value xmldb datastore])],
|
||||
[],
|
||||
[with_keyvalue=no])
|
||||
echo "keyvalue:${with_keyvalue}"
|
||||
if test "x${with_keyvalue}" == xyes; then
|
||||
echo "yes keyvalue"
|
||||
# This is for qdbm
|
||||
AC_ARG_WITH(qdbm, [ --with-qdbm=dir Use QDBM here, if keyvalue ] )
|
||||
if test "${with_qdbm}"; then
|
||||
|
|
@ -156,6 +156,24 @@ if test "x${with_keyvalue}" == xyes; then
|
|||
AC_CHECK_LIB(qdbm, dpopen,, AC_MSG_ERROR(libqdbm-dev required))
|
||||
fi
|
||||
|
||||
# This is for backward compatibility of backend startup commands
|
||||
AC_ARG_WITH([startup_compat],
|
||||
[AS_HELP_STRING([--with-startup-compat],[Backward compatibility of backend startup commands])],
|
||||
[],
|
||||
[with_startup_compat=no])
|
||||
if test "x${with_startup_compat}" == xyes; then
|
||||
AC_DEFINE_UNQUOTED(BACKEND_STARTUP_COMPAT, $with_startup_compat, [Backward compatible backend startup command-line options])
|
||||
fi
|
||||
|
||||
# This is for backward compatibility of .conf configuration file
|
||||
AC_ARG_WITH([config_compat],
|
||||
[AS_HELP_STRING([--with-config-compat],[Backward compatibility of ocnfiguration file])],
|
||||
[],
|
||||
[with_config_compat=no])
|
||||
if test "x${with_config_compat}" == xyes; then
|
||||
AC_DEFINE_UNQUOTED(CONFIG_COMPAT, $with_config_compat, [Backward compatible of .conf configuration files])
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(crypt, crypt)
|
||||
AC_CHECK_HEADERS(crypt.h)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
/* include/clixon_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Backward compatible backend startup command-line options */
|
||||
#undef BACKEND_STARTUP_COMPAT
|
||||
|
||||
/* Clixon data dir for system yang files etc */
|
||||
#undef CLIXON_DATADIR
|
||||
|
||||
|
|
@ -15,6 +18,9 @@
|
|||
/* Clixon version string */
|
||||
#undef CLIXON_VERSION_STRING
|
||||
|
||||
/* Backward compatible of .conf configuration files */
|
||||
#undef CONFIG_COMPAT
|
||||
|
||||
/* Define to 1 if you have the `alphasort' function. */
|
||||
#undef HAVE_ALPHASORT
|
||||
|
||||
|
|
@ -33,6 +39,9 @@
|
|||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `cligen' library (-lcligen). */
|
||||
#undef HAVE_LIBCLIGEN
|
||||
|
||||
/* Define to 1 if you have the `crypt' library (-lcrypt). */
|
||||
#undef HAVE_LIBCRYPT
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,3 @@ int strverscmp (__const char *__s1, __const char *__s2);
|
|||
*/
|
||||
#define XML_CHILD_HASH 1
|
||||
|
||||
/* Backward compatible clixon backend daemon startup sequences
|
||||
* This has been replaced with -s <mode> and CLICON_STARTUP_MODE
|
||||
* define if enable backward compatible behaviour
|
||||
* Remove in 3.3.4
|
||||
*/
|
||||
#undef BACKEND_STARTUP_BACKWARD_COMPAT
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ clicon_option_readfile_xml(clicon_hash_t *copt,
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||
/*! Read filename and set values to global options registry
|
||||
* For legacy configuration file, ie not xml
|
||||
|
|
@ -344,6 +345,7 @@ clicon_option_sanity(clicon_hash_t *copt)
|
|||
done:
|
||||
return retval;
|
||||
}
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
/*! Initialize option values
|
||||
*
|
||||
|
|
@ -386,6 +388,7 @@ clicon_options_main(clicon_handle h)
|
|||
yspec_free(yspec);
|
||||
}
|
||||
else {
|
||||
#ifdef CONFIG_COMPAT
|
||||
/* Set default options */
|
||||
if (clicon_option_default(copt) < 0) /* init registry from file */
|
||||
goto done;
|
||||
|
|
@ -394,6 +397,10 @@ clicon_options_main(clicon_handle h)
|
|||
goto done;
|
||||
if (clicon_option_sanity(copt) < 0)
|
||||
goto done;
|
||||
#else /* CONFIG_COMPAT */
|
||||
clicon_err(OE_CFG, 0, "%s: suffix %s not recognized (Run ./configure --with-config-compat?)", configfile, suffix);
|
||||
goto done;
|
||||
#endif /* CONFIG_COMPAT */
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue