summaryrefslogtreecommitdiffstats
path: root/zebra/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/main.c')
-rw-r--r--zebra/main.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/zebra/main.c b/zebra/main.c
index d829c046..b58fed12 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -32,6 +32,7 @@
#include "plist.h"
#include "privs.h"
#include "sigevent.h"
+#include "paths.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
@@ -68,6 +69,7 @@ struct option longopts[] =
{
{ "batch", no_argument, NULL, 'b'},
{ "daemon", no_argument, NULL, 'd'},
+ { "namespace", required_argument, NULL, 'N'},
{ "keep_kernel", no_argument, NULL, 'k'},
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
@@ -108,10 +110,13 @@ struct zebra_privs_t zserv_privs =
};
/* Default configuration file path. */
-char config_default[] = SYSCONFDIR DEFAULT_CONFIG_FILE;
+char config_default[MAXPATHLEN];
+
+/* pid_file default value */
+static char pid_file_default[MAXPATHLEN];
/* Process ID saved for use by init system */
-const char *pid_file = PATH_ZEBRA_PID;
+const char *pid_file = pid_file_default;
/* Help information display. */
static void
@@ -126,6 +131,7 @@ usage (char *progname, int status)
"redistribution between different routing protocols.\n\n"\
"-b, --batch Runs in batch mode\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"\
"-k, --keep_kernel Don't delete old routes which installed by "\
@@ -229,9 +235,9 @@ main (int argc, char **argv)
int opt;
#ifdef HAVE_NETLINK
- opt = getopt_long (argc, argv, "bdkf:i:hA:P:ru:g:vs:C", longopts, 0);
+ opt = getopt_long (argc, argv, "bdN:kf:i:hA:P:ru:g:vs:C", longopts, 0);
#else
- opt = getopt_long (argc, argv, "bdkf:i:hA:P:ru:g:vC", longopts, 0);
+ opt = getopt_long (argc, argv, "bdN:kf:i:hA:P:ru:g:vC", longopts, 0);
#endif /* HAVE_NETLINK */
if (opt == EOF)
@@ -246,6 +252,9 @@ main (int argc, char **argv)
case 'd':
daemon_mode = 1;
break;
+ case 'N':
+ path_set_namespace (optarg);
+ break;
case 'k':
keep_kernel_mode = 1;
break;
@@ -300,6 +309,9 @@ main (int argc, char **argv)
}
}
+ strcpy (config_default, path_config (ZEBRA_CONFIG_NAME));
+ strcpy (pid_file_default, path_state (ZEBRA_PID_NAME));
+
/* Make master thread emulator. */
zebrad.master = thread_master_create ();
@@ -389,7 +401,7 @@ main (int argc, char **argv)
zebra_zserv_socket_init ();
/* Make vty server socket. */
- vty_serv_sock (vty_addr, vty_port, ZEBRA_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, path_state (ZEBRA_VTY_NAME));
/* Print banner. */
zlog_notice ("Zebra %s starting: vty@%d", QUAGGA_VERSION, vty_port);