diff options
Diffstat (limited to 'ospf6d/ospf6_main.c')
-rw-r--r-- | ospf6d/ospf6_main.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index a7a96a1f..c33fe9f2 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -34,11 +34,14 @@ #include "plist.h" #include "privs.h" #include "sigevent.h" +#include "paths.h" #include "ospf6d.h" /* Default configuration file name for ospf6d. */ -#define OSPF6_DEFAULT_CONFIG "ospf6d.conf" +#define OSPF6_CONFIG_NAME "ospf6d.conf" +#define OSPF6_PID_NAME "ospf6d.pid" +#define OSPF6_VTY_NAME "ospf6d.vty" /* Default port values. */ #define OSPF6_VTY_PORT 2606 @@ -70,6 +73,7 @@ struct zebra_privs_t ospf6d_privs = struct option longopts[] = { { "daemon", no_argument, NULL, 'd'}, + { "namespace", required_argument, NULL, 'N'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "vty_addr", required_argument, NULL, 'A'}, @@ -83,7 +87,7 @@ struct option longopts[] = }; /* Configuration file and directory. */ -char config_default[] = SYSCONFDIR OSPF6_DEFAULT_CONFIG; +char config_default[MAXPATHLEN]; /* ospf6d program name. */ char *progname; @@ -94,8 +98,11 @@ int daemon_mode = 0; /* Master of threads. */ struct thread_master *master; +/* pid_file default value */ +static char pid_file_default[MAXPATHLEN]; + /* Process ID saved for use by init system */ -const char *pid_file = PATH_OSPF6D_PID; +const char *pid_file = pid_file_default; /* Help information display. */ static void @@ -108,6 +115,7 @@ usage (char *progname, int status) printf ("Usage : %s [OPTION...]\n\n\ Daemon which manages OSPF version 3.\n\n\ -d, --daemon Runs in daemon mode\n\ +-N, --namespace Insert argument into all paths\n\ -f, --config_file Set configuration file name\n\ -i, --pid_file Set process identifier file name\n\ -A, --vty_addr Set vty's bind address\n\ @@ -197,7 +205,7 @@ main (int argc, char *argv[], char *envp[]) /* Command line argument treatment. */ while (1) { - opt = getopt_long (argc, argv, "df:i:hp:A:P:u:g:vC", longopts, 0); + opt = getopt_long (argc, argv, "dN:f:i:hp:A:P:u:g:vC", longopts, 0); if (opt == EOF) break; @@ -209,6 +217,9 @@ main (int argc, char *argv[], char *envp[]) case 'd': daemon_mode = 1; break; + case 'N': + path_set_namespace (optarg); + break; case 'f': config_file = optarg; break; @@ -252,6 +263,9 @@ main (int argc, char *argv[], char *envp[]) } } + strcpy (config_default, path_config (OSPF6_CONFIG_NAME)); + strcpy (pid_file_default, path_state (OSPF6_PID_NAME)); + /* thread master */ master = thread_master_create (); @@ -294,7 +308,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, path_state (OSPF6_VTY_NAME)); /* Print start message */ zlog_notice ("OSPF6d (Quagga-%s ospf6d-%s) starts: vty@%d", |