summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 9d14683c..f761f238 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -35,6 +35,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "routemap.h"
#include "filter.h"
#include "plist.h"
+#include "paths.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
@@ -52,6 +53,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
static const 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'},
{ "bgp_port", required_argument, NULL, 'p'},
@@ -96,7 +98,7 @@ static struct quagga_signal_t bgp_signals[] =
};
/* Configuration file and directory. */
-char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
+static char config_default[MAXPATHLEN];
/* Route retain mode flag. */
static int retain_mode = 0;
@@ -107,8 +109,11 @@ struct thread_master *master;
/* Manually specified configuration file name. */
char *config_file = NULL;
+/* pid_file default value */
+static char pid_file_default[MAXPATHLEN];
+
/* Process ID saved for use by init system */
-static const char *pid_file = PATH_BGPD_PID;
+static const char *pid_file = pid_file_default;
/* VTY port number and address. */
int vty_port = BGP_VTY_PORT;
@@ -147,6 +152,7 @@ usage (char *progname, int status)
Daemon which manages kernel routing table management and \
redistribution between different routing protocols.\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\
-p, --bgp_port Set bgp protocol's port number\n\
@@ -182,7 +188,7 @@ sighup (void)
vty_read_config (config_file, config_default);
/* Create VTY's socket */
- vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, path_state (BGP_VTY_NAME));
/* Try to return to normal operation. */
}
@@ -327,7 +333,7 @@ main (int argc, char **argv)
/* Command line argument treatment. */
while (1)
{
- opt = getopt_long (argc, argv, "df:i:hp:l:A:P:rnu:g:vC", longopts, 0);
+ opt = getopt_long (argc, argv, "dN:f:i:hp:l:A:P:rnu:g:vC", longopts, 0);
if (opt == EOF)
break;
@@ -339,6 +345,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;
@@ -398,6 +407,9 @@ main (int argc, char **argv)
}
}
+ strcpy (config_default, path_config (BGP_CONFIG_NAME));
+ strcpy (pid_file_default, path_state (BGP_PID_NAME));
+
/* Make thread master. */
master = bm->master;
@@ -434,7 +446,7 @@ main (int argc, char **argv)
pid_output (pid_file);
/* Make bgp vty socket. */
- vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, path_state (BGP_VTY_NAME));
/* Print banner. */
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", QUAGGA_VERSION,