summaryrefslogtreecommitdiffstats
path: root/pimd/pim_main.c
diff options
context:
space:
mode:
authorMartin Winter <mwinter@opensourcerouting.org>2017-01-24 16:58:52 +0100
committerMartin Winter <mwinter@opensourcerouting.org>2017-01-25 18:41:46 +0100
commita8cdea56f44d2d2a3d09ea444ac03fc15a65ff49 (patch)
tree45903a29bca73e2eca228a0ad3df080d7a36e9e5 /pimd/pim_main.c
parentospfd: Add vty_socket cli option to override the compiled-in location for the... (diff)
downloadfrr-a8cdea56f44d2d2a3d09ea444ac03fc15a65ff49.tar.xz
frr-a8cdea56f44d2d2a3d09ea444ac03fc15a65ff49.zip
pimd: 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 'pimd/pim_main.c')
-rw-r--r--pimd/pim_main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pimd/pim_main.c b/pimd/pim_main.c
index 7dfddd299..1a3c8165e 100644
--- a/pimd/pim_main.c
+++ b/pimd/pim_main.c
@@ -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);