]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Add vty_socket cli option to override the compiled-in location for the VTY...
authorMartin Winter <mwinter@opensourcerouting.org>
Tue, 24 Jan 2017 15:58:52 +0000 (22:58 +0700)
committerMartin Winter <mwinter@opensourcerouting.org>
Wed, 25 Jan 2017 17:41:46 +0000 (00:41 +0700)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
pimd/pim_main.c

index 7dfddd299125f9a60ec8021f881ec83101e9b950..1a3c8165e4656491667bc60a4eceab9f33a245d5 100644 (file)
@@ -52,6 +52,8 @@ extern struct host host;
 
 char config_default[] = SYSCONFDIR PIMD_DEFAULT_CONFIG;
 
+/* pimd options */
+#define OPTION_VTYSOCK 1000
 struct option longopts[] = {
   { "daemon",        no_argument,       NULL, 'd'},
   { "config_file",   required_argument, NULL, 'f'},
@@ -59,12 +61,16 @@ struct option longopts[] = {
   { "socket",        required_argument, NULL, 'z'},
   { "vty_addr",      required_argument, NULL, 'A'},
   { "vty_port",      required_argument, NULL, 'P'},
+  { "vty_socket",    required_argument, NULL, OPTION_VTYSOCK},
   { "version",       no_argument,       NULL, 'v'},
   { "debug_zclient", no_argument,       NULL, 'Z'},
   { "help",          no_argument,       NULL, 'h'},
   { 0 }
 };
 
+/* VTY Socket prefix */
+char vty_sock_path[MAXPATHLEN] = PIM_VTYSH_PATH;
+
 /* pimd privileges */
 zebra_capabilities_t _caps_p [] = 
 {
@@ -104,6 +110,7 @@ Daemon which manages PIM.\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\
 -v, --version        Print program version\n\
 "
 
@@ -126,6 +133,7 @@ Report bugs to %s\n", progname, PIMD_BUG_ADDRESS);
 int main(int argc, char** argv, char** envp) {
   char *p;
   char *vty_addr = NULL;
+  char *vty_sock_name;
   int vty_port = -1;
   int daemon_mode = 0;
   char *config_file = NULL;
@@ -173,6 +181,9 @@ int main(int argc, char** argv, char** envp) {
     case 'P':
       vty_port = atoi (optarg);
       break;
+    case OPTION_VTYSOCK:
+      set_socket_path(vty_sock_path, PIM_VTYSH_PATH, optarg, sizeof (vty_sock_path));
+      break;
     case 'v':
       printf(PIMD_PROGNAME " version %s\n", PIMD_VERSION);
       print_version(progname);
@@ -239,7 +250,7 @@ int main(int argc, char** argv, char** envp) {
   /* Create pimd VTY socket */
   if (vty_port < 0)
     vty_port = PIMD_VTY_PORT;
-  vty_serv_sock(vty_addr, vty_port, PIM_VTYSH_PATH);
+  vty_serv_sock(vty_addr, vty_port, vty_sock_path);
 
   zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting, VTY interface at port TCP %d",
              FRR_VERSION, PIMD_VERSION, vty_port);