diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index bd10b8f8..e9cdc424 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -71,7 +71,7 @@ #include "cli_handle.h" /* Command line options to be passed to getopt(3) */ -#define CLI_OPTS "hD:f:xl:F:1u:d:m:qpGLy:c:U:" +#define CLI_OPTS "hD:f:xl:F:1a:u:d:m:qpGLy:c:U:" /*! terminate cli application */ static int @@ -197,7 +197,6 @@ static void usage(clicon_handle h, char *argv0) { - char *confsock = clicon_sock(h); char *plgdir = clicon_cli_dir(h); fprintf(stderr, "usage:%s [options] [commands]\n" @@ -209,7 +208,8 @@ usage(clicon_handle h, "\t-x\t\tDump configuration file as XML on stdout (migration utility)\n" "\t-F \tRead commands from file (default stdin)\n" "\t-1\t\tDo not enter interactive mode\n" - "\t-u \tconfig UNIX domain path (default: %s)\n" + "\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n" + "\t-u \tInternal socket domain path or IP addr (see -a)\n" "\t-d \tSpecify plugin directory (default: %s)\n" "\t-m \tSpecify plugin syntax mode\n" "\t-q \t\tQuiet mode, dont print greetings or prompt, terminate on ctrl-C\n" @@ -221,7 +221,6 @@ usage(clicon_handle h, "\t-c \tSpecify cli spec file.\n" "\t-U \tOver-ride unix user with a pseudo user for NACM.\n", argv0, - confsock ? confsock : "none", plgdir ? plgdir : "none" ); exit(1); @@ -354,7 +353,10 @@ main(int argc, char **argv) case '1' : /* Quit after reading database once - dont wait for events */ once = 1; break; - case 'u': /* config unix domain path/ ip host */ + case 'a': /* internal backend socket address family */ + clicon_option_str_set(h, "CLICON_SOCK_FAMILY", optarg); + break; + case 'u': /* internal backend socket unix domain path or ip host */ if (!strlen(optarg)) usage(h, argv[0]); clicon_option_str_set(h, "CLICON_SOCK", optarg); diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 9811d959..1c203fff 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -71,7 +71,7 @@ #include "netconf_rpc.h" /* Command line options to be passed to getopt(3) */ -#define NETCONF_OPTS "hDqf:d:Sy:U:" +#define NETCONF_OPTS "hDqf:a:u:d:Sy:U:" /*! Process incoming packet * @param[in] h Clicon handle @@ -296,6 +296,8 @@ usage(clicon_handle h, "\t-D\t\tDebug\n" "\t-q\t\tQuiet: dont send hello prompt\n" "\t-f \tConfiguration file (mandatory)\n" + "\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n" + "\t-u \tInternal socket domain path or IP addr (see -a)\n" "\t-d \tSpecify netconf plugin directory dir (default: %s)\n" "\t-S\t\tLog on syslog\n" "\t-y \tOverride yang spec file (dont include .yang suffix)\n" @@ -374,6 +376,14 @@ main(int argc, case 'f': /* config file */ case 'S': /* Log on syslog */ break; /* see above */ + case 'a': /* internal backend socket address family */ + clicon_option_str_set(h, "CLICON_SOCK_FAMILY", optarg); + break; + case 'u': /* internal backend socket unix domain path or ip host */ + if (!strlen(optarg)) + usage(h, argv[0]); + clicon_option_str_set(h, "CLICON_SOCK", optarg); + break; case 'q': /* quiet: dont write hello */ quiet++; break; diff --git a/apps/restconf/restconf_main.c b/apps/restconf/restconf_main.c index 7ffc9260..e43f6c96 100644 --- a/apps/restconf/restconf_main.c +++ b/apps/restconf/restconf_main.c @@ -74,7 +74,7 @@ #include "restconf_methods.h" /* Command line options to be passed to getopt(3) */ -#define RESTCONF_OPTS "hDf:p:y:" +#define RESTCONF_OPTS "hDf:p:y:a:u:" /* RESTCONF enables deployments to specify where the RESTCONF API is located. The client discovers this by getting the "/.well-known/host-meta" @@ -488,7 +488,9 @@ usage(clicon_handle h, "\t-D \t\tDebug. Log to syslog\n" "\t-f \tConfiguration file (mandatory)\n" "\t-d \tSpecify restconf plugin directory dir (default: %s)\n" - "\t-y \tOverride yang spec file (dont include .yang suffix)\n", + "\t-y \tOverride yang spec file (dont include .yang suffix)\n" + "\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n" + "\t-u \tInternal socket domain path or IP addr (see -a)\n", argv0, clicon_restconf_dir(h) ); @@ -541,6 +543,14 @@ main(int argc, case 'y' : /* yang module */ yangspec = optarg; break; + case 'a': /* internal backend socket address family */ + clicon_option_str_set(h, "CLICON_SOCK_FAMILY", optarg); + break; + case 'u': /* internal backend socket unix domain path or ip host */ + if (!strlen(optarg)) + usage(h, argv[0]); + clicon_option_str_set(h, "CLICON_SOCK", optarg); + break; default: usage(h, argv[0]); break; diff --git a/doc/FAQ.md b/doc/FAQ.md index c1d130d0..64ba9f3c 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -43,7 +43,7 @@ The example: ## Do I need to setup anything? (IMPORTANT) -The config demon requires a valid group to create a server UNIX socket. +The config demon requires a valid group to create a server UNIX domain socket. Define a valid CLICON_SOCK_GROUP in the config file or via the -g option or create the group and add the user to it. The default group is 'clicon'. Add yourself and www-data, if you intend to use restconf. diff --git a/lib/src/clixon_plugin.c b/lib/src/clixon_plugin.c index 2631938c..5e17cd1e 100644 --- a/lib/src/clixon_plugin.c +++ b/lib/src/clixon_plugin.c @@ -189,7 +189,7 @@ plugin_load_one(clicon_handle h, char *name; char *p; - clicon_debug(1, "%s", __FUNCTION__); + clicon_debug(1, "%s file:%s function:%s", __FUNCTION__, file, function); dlerror(); /* Clear any existing error */ if ((handle = dlopen(file, dlflags)) == NULL) { error = (char*)dlerror();