diff options
Diffstat (limited to 'ospfd/ospf_main.c')
-rw-r--r-- | ospfd/ospf_main.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 8b9a3458..0e9e182a 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -38,6 +38,7 @@ #include "memory.h" #include "privs.h" #include "sigevent.h" +#include "paths.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" @@ -72,12 +73,13 @@ struct zebra_privs_t ospfd_privs = }; /* Configuration filename and directory. */ -char config_default[] = SYSCONFDIR OSPF_DEFAULT_CONFIG; +char config_default[MAXPATHLEN]; /* OSPFd options. */ 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'}, { "dryrun", no_argument, NULL, 'C'}, @@ -96,8 +98,11 @@ struct option longopts[] = /* 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_OSPFD_PID; +const char *pid_file = pid_file_default; #ifdef SUPPORT_OSPF_API extern int ospf_apiserver_enable; @@ -114,6 +119,7 @@ usage (char *progname, int status) printf ("Usage : %s [OPTION...]\n\ Daemon which manages OSPF.\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\ @@ -214,7 +220,7 @@ main (int argc, char **argv) { int opt; - opt = getopt_long (argc, argv, "df:i:hA:P:u:g:avC", longopts, 0); + opt = getopt_long (argc, argv, "dN:f:i:hA:P:u:g:avC", longopts, 0); if (opt == EOF) break; @@ -226,6 +232,9 @@ main (int argc, char **argv) case 'd': daemon_mode = 1; break; + case 'N': + path_set_namespace (optarg); + break; case 'f': config_file = optarg; break; @@ -274,6 +283,9 @@ main (int argc, char **argv) } } + strcpy (config_default, path_config (OSPF_CONFIG_NAME)); + strcpy (pid_file_default, path_state (OSPF_PID_NAME)); + /* Initializations. */ master = om->master; @@ -324,7 +336,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Create VTY socket */ - vty_serv_sock (vty_addr, vty_port, OSPF_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, path_state (OSPF_VTY_NAME)); /* Print banner. */ zlog_notice ("OSPFd %s starting: vty@%d", QUAGGA_VERSION, vty_port); |