backend socket options -a -u
This commit is contained in:
parent
c6a62b96de
commit
539a60d613
5 changed files with 32 additions and 10 deletions
|
|
@ -71,7 +71,7 @@
|
||||||
#include "cli_handle.h"
|
#include "cli_handle.h"
|
||||||
|
|
||||||
/* Command line options to be passed to getopt(3) */
|
/* 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 */
|
/*! terminate cli application */
|
||||||
static int
|
static int
|
||||||
|
|
@ -197,7 +197,6 @@ static void
|
||||||
usage(clicon_handle h,
|
usage(clicon_handle h,
|
||||||
char *argv0)
|
char *argv0)
|
||||||
{
|
{
|
||||||
char *confsock = clicon_sock(h);
|
|
||||||
char *plgdir = clicon_cli_dir(h);
|
char *plgdir = clicon_cli_dir(h);
|
||||||
|
|
||||||
fprintf(stderr, "usage:%s [options] [commands]\n"
|
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-x\t\tDump configuration file as XML on stdout (migration utility)\n"
|
||||||
"\t-F <file> \tRead commands from file (default stdin)\n"
|
"\t-F <file> \tRead commands from file (default stdin)\n"
|
||||||
"\t-1\t\tDo not enter interactive mode\n"
|
"\t-1\t\tDo not enter interactive mode\n"
|
||||||
"\t-u <sockpath>\tconfig UNIX domain path (default: %s)\n"
|
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
||||||
|
"\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n"
|
||||||
"\t-d <dir>\tSpecify plugin directory (default: %s)\n"
|
"\t-d <dir>\tSpecify plugin directory (default: %s)\n"
|
||||||
"\t-m <mode>\tSpecify plugin syntax mode\n"
|
"\t-m <mode>\tSpecify plugin syntax mode\n"
|
||||||
"\t-q \t\tQuiet mode, dont print greetings or prompt, terminate on ctrl-C\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 <file>\tSpecify cli spec file.\n"
|
"\t-c <file>\tSpecify cli spec file.\n"
|
||||||
"\t-U <user>\tOver-ride unix user with a pseudo user for NACM.\n",
|
"\t-U <user>\tOver-ride unix user with a pseudo user for NACM.\n",
|
||||||
argv0,
|
argv0,
|
||||||
confsock ? confsock : "none",
|
|
||||||
plgdir ? plgdir : "none"
|
plgdir ? plgdir : "none"
|
||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
@ -354,7 +353,10 @@ main(int argc, char **argv)
|
||||||
case '1' : /* Quit after reading database once - dont wait for events */
|
case '1' : /* Quit after reading database once - dont wait for events */
|
||||||
once = 1;
|
once = 1;
|
||||||
break;
|
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))
|
if (!strlen(optarg))
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
clicon_option_str_set(h, "CLICON_SOCK", optarg);
|
clicon_option_str_set(h, "CLICON_SOCK", optarg);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
#include "netconf_rpc.h"
|
#include "netconf_rpc.h"
|
||||||
|
|
||||||
/* Command line options to be passed to getopt(3) */
|
/* 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
|
/*! Process incoming packet
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
|
|
@ -296,6 +296,8 @@ usage(clicon_handle h,
|
||||||
"\t-D\t\tDebug\n"
|
"\t-D\t\tDebug\n"
|
||||||
"\t-q\t\tQuiet: dont send hello prompt\n"
|
"\t-q\t\tQuiet: dont send hello prompt\n"
|
||||||
"\t-f <file>\tConfiguration file (mandatory)\n"
|
"\t-f <file>\tConfiguration file (mandatory)\n"
|
||||||
|
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
||||||
|
"\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n"
|
||||||
"\t-d <dir>\tSpecify netconf plugin directory dir (default: %s)\n"
|
"\t-d <dir>\tSpecify netconf plugin directory dir (default: %s)\n"
|
||||||
"\t-S\t\tLog on syslog\n"
|
"\t-S\t\tLog on syslog\n"
|
||||||
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n"
|
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n"
|
||||||
|
|
@ -374,6 +376,14 @@ main(int argc,
|
||||||
case 'f': /* config file */
|
case 'f': /* config file */
|
||||||
case 'S': /* Log on syslog */
|
case 'S': /* Log on syslog */
|
||||||
break; /* see above */
|
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 */
|
case 'q': /* quiet: dont write hello */
|
||||||
quiet++;
|
quiet++;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
#include "restconf_methods.h"
|
#include "restconf_methods.h"
|
||||||
|
|
||||||
/* Command line options to be passed to getopt(3) */
|
/* 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
|
/* RESTCONF enables deployments to specify where the RESTCONF API is
|
||||||
located. The client discovers this by getting the "/.well-known/host-meta"
|
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-D \t\tDebug. Log to syslog\n"
|
||||||
"\t-f <file>\tConfiguration file (mandatory)\n"
|
"\t-f <file>\tConfiguration file (mandatory)\n"
|
||||||
"\t-d <dir>\tSpecify restconf plugin directory dir (default: %s)\n"
|
"\t-d <dir>\tSpecify restconf plugin directory dir (default: %s)\n"
|
||||||
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n",
|
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n"
|
||||||
|
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
||||||
|
"\t-u <path|addr>\tInternal socket domain path or IP addr (see -a)\n",
|
||||||
argv0,
|
argv0,
|
||||||
clicon_restconf_dir(h)
|
clicon_restconf_dir(h)
|
||||||
);
|
);
|
||||||
|
|
@ -541,6 +543,14 @@ main(int argc,
|
||||||
case 'y' : /* yang module */
|
case 'y' : /* yang module */
|
||||||
yangspec = optarg;
|
yangspec = optarg;
|
||||||
break;
|
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:
|
default:
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ The example:
|
||||||
|
|
||||||
## Do I need to setup anything? (IMPORTANT)
|
## 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
|
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'.
|
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.
|
Add yourself and www-data, if you intend to use restconf.
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ plugin_load_one(clicon_handle h,
|
||||||
char *name;
|
char *name;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(1, "%s file:%s function:%s", __FUNCTION__, file, function);
|
||||||
dlerror(); /* Clear any existing error */
|
dlerror(); /* Clear any existing error */
|
||||||
if ((handle = dlopen(file, dlflags)) == NULL) {
|
if ((handle = dlopen(file, dlflags)) == NULL) {
|
||||||
error = (char*)dlerror();
|
error = (char*)dlerror();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue