diff options
Diffstat (limited to 'ripd/rip_main.c')
| -rw-r--r-- | ripd/rip_main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ripd/rip_main.c b/ripd/rip_main.c index cfcb60168a..58dd2df6fa 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -35,10 +35,12 @@ #include "sigevent.h" #include "zclient.h" #include "vrf.h" +#include "sockopt.h" #include "ripd/ripd.h" /* ripd options. */ +#define OPTION_VTYSOCK 1000 static struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, @@ -49,6 +51,7 @@ static struct option longopts[] = { "dryrun", no_argument, NULL, 'C'}, { "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'}, @@ -85,6 +88,9 @@ char *config_file = NULL; /* ripd program name */ +/* VTY Socket prefix */ +char vty_sock_path[MAXPATHLEN] = RIP_VTYSH_PATH; + /* Route retain mode flag. */ int retain_mode = 0; @@ -116,6 +122,7 @@ Daemon which manages RIP version 1 and 2.\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\ -C, --dryrun Check configuration for validity and exit\n\ -r, --retain When program terminates, retain added route by ripd.\n\ -u, --user User to run as\n\ @@ -142,7 +149,7 @@ sighup (void) vty_read_config (config_file, config_default); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Try to return to normal operation. */ } @@ -251,6 +258,9 @@ main (int argc, char **argv) if (vty_port <= 0 || vty_port > 0xffff) vty_port = RIP_VTY_PORT; break; + case OPTION_VTYSOCK: + set_socket_path(vty_sock_path, RIP_VTYSH_PATH, optarg, sizeof (vty_sock_path)); + break; case 'r': retain_mode = 1; break; @@ -311,7 +321,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Create VTY's socket */ - vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, vty_sock_path); /* Print banner. */ zlog_notice ("RIPd %s starting: vty@%d", FRR_VERSION, vty_port); |
