diff options
author | Martin Winter <mwinter@opensourcerouting.org> | 2017-01-24 18:25:28 +0100 |
---|---|---|
committer | Martin Winter <mwinter@opensourcerouting.org> | 2017-01-25 18:42:14 +0100 |
commit | 7fa382d1d0f4c34dd7f8bf161666d04b6f608898 (patch) | |
tree | c3ccceda6174db4895cef60199de50ff5e584480 /ripngd | |
parent | ripd: Add vty_socket cli option to override the compiled-in location for the ... (diff) | |
download | frr-7fa382d1d0f4c34dd7f8bf161666d04b6f608898.tar.xz frr-7fa382d1d0f4c34dd7f8bf161666d04b6f608898.zip |
ripngd: Add vty_socket cli option to override the compiled-in location for the VTY Socket
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Diffstat (limited to 'ripngd')
-rw-r--r-- | ripngd/ripng_main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 14711a1a6..1677996ea 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -44,6 +44,7 @@ char config_default[] = SYSCONFDIR RIPNG_DEFAULT_CONFIG; char *config_file = NULL; /* RIPngd options. */ +#define OPTION_VTYSOCK 1000 struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -54,6 +55,7 @@ struct option longopts[] = { "help", no_argument, NULL, 'h'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, + { "vty_socket", required_argument, NULL, OPTION_VTYSOCK}, { "retain", no_argument, NULL, 'r'}, { "user", required_argument, NULL, 'u'}, { "group", required_argument, NULL, 'g'}, @@ -87,6 +89,9 @@ struct zebra_privs_t ripngd_privs = /* RIPngd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIPNG_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -118,6 +123,7 @@ Daemon which manages RIPng.\n\n\ -z, --socket Set path of zebra socket\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ + --vty_socket Override vty socket path\n\ -r, --retain When program terminates, retain added route by ripngd.\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ @@ -141,7 +147,7 @@ sighup (void) /* Reload config file. */ vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -195,6 +201,7 @@ main (int argc, char **argv) char *progname; struct thread thread; int dryrun = 0; + char *vty_sock_name; /* Set umask before anything for security */ umask (0027); @@ -249,6 +256,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIPNG_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIPNG_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -303,7 +313,7 @@ main (int argc, char **argv) } /* Create VTY socket */ - vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Process id file create. */ pid_output (pid_file); |