summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_main.c
diff options
context:
space:
mode:
authorMartin Winter <mwinter@opensourcerouting.org>2017-01-24 16:55:26 +0100
committerMartin Winter <mwinter@opensourcerouting.org>2017-01-25 18:41:32 +0100
commita766b038f51f7716d928f3d4695b40d4bdc01e32 (patch)
treef93cedde1341b57353d1b227ea34404fe1d87e22 /ospf6d/ospf6_main.c
parentisisd: Add vty_socket cli option to override the compiled-in location for the... (diff)
downloadfrr-a766b038f51f7716d928f3d4695b40d4bdc01e32.tar.xz
frr-a766b038f51f7716d928f3d4695b40d4bdc01e32.zip
ospf6d: 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 'ospf6d/ospf6_main.c')
-rw-r--r--ospf6d/ospf6_main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index bd3a2faa5..68d2b6894 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -51,6 +51,9 @@
/* Default configuration file name for ospf6d. */
#define OSPF6_DEFAULT_CONFIG "ospf6d.conf"
+/* VTY Socket prefix */
+char vty_sock_path[MAXPATHLEN] = OSPF6_VTYSH_PATH;
+
/* Default port values. */
#define OSPF6_VTY_PORT 2606
@@ -78,6 +81,7 @@ struct zebra_privs_t ospf6d_privs =
};
/* ospf6d options, we use GNU getopt library. */
+#define OPTION_VTYSOCK 1000
struct option longopts[] =
{
{ "daemon", no_argument, NULL, 'd'},
@@ -86,6 +90,7 @@ 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},
{ "user", required_argument, NULL, 'u'},
{ "group", required_argument, NULL, 'g'},
{ "version", no_argument, NULL, 'v'},
@@ -125,6 +130,7 @@ Daemon which manages OSPF version 3.\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\
-u, --user User to run as\n\
-g, --group Group to run as\n\
-v, --version Print program version\n\
@@ -233,6 +239,7 @@ main (int argc, char *argv[], char *envp[])
int opt;
char *vty_addr = NULL;
int vty_port = 0;
+ char *vty_sock_name;
char *config_file = NULL;
struct thread thread;
int dryrun = 0;
@@ -285,6 +292,9 @@ main (int argc, char *argv[], char *envp[])
if (vty_port <= 0 || vty_port > 0xffff)
vty_port = OSPF6_VTY_PORT;
break;
+ case OPTION_VTYSOCK:
+ set_socket_path(vty_sock_path, OSPF6_VTYSH_PATH, optarg, sizeof (vty_sock_path));
+ break;
case 'u':
ospf6d_privs.user = optarg;
break;
@@ -357,7 +367,7 @@ main (int argc, char *argv[], char *envp[])
/* Make ospf6 vty socket. */
if (!vty_port)
vty_port = OSPF6_VTY_PORT;
- vty_serv_sock (vty_addr, vty_port, OSPF6_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, vty_sock_path);
/* Print start message */
zlog_notice ("OSPF6d (Quagga-%s ospf6d-%s) starts: vty@%d",