diff options
author | David Lamparter <equinox@diac24.net> | 2009-10-14 18:13:29 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-04 02:53:48 +0100 |
commit | ac9ed56d887357049bae1bc901e80b58961d6380 (patch) | |
tree | a5cd31094ee55324fe6a57212c03c6f7828673c4 /bgpd | |
parent | f99eea6053507e6dbd5ad22f4c7ba80c5a981651 (diff) | |
download | quagga-ac9ed56d887357049bae1bc901e80b58961d6380.tar.bz2 quagga-ac9ed56d887357049bae1bc901e80b58961d6380.tar.xz |
lib: fs namespacing 2/5: use path_state for vty paths
use the path_state helper functions for determining vty socket paths in
all quagga daemons. this allows for running multiple daemons if a
namespace name is set.
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/Makefile.am | 1 | ||||
-rw-r--r-- | bgpd/bgp_main.c | 15 | ||||
-rw-r--r-- | bgpd/bgpd.h | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am index 1b17d386..56a9fb8f 100644 --- a/bgpd/Makefile.am +++ b/bgpd/Makefile.am @@ -1,7 +1,6 @@ ## Process this file with automake to produce Makefile.in. INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@ -DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" INSTALL_SDATA=@INSTALL@ -m 600 AM_CFLAGS = $(PICFLAGS) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 9d14683c..f6dc1cae 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" @@ -96,7 +97,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 +108,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; @@ -182,7 +186,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. */ } @@ -398,6 +402,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 +441,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, diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 49664030..77c26646 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -739,7 +739,9 @@ struct bgp_nlri /* Default configuration settings for bgpd. */ #define BGP_VTY_PORT 2605 -#define BGP_DEFAULT_CONFIG "bgpd.conf" +#define BGP_CONFIG_NAME "bgpd.conf" +#define BGP_PID_NAME "bgpd.pid" +#define BGP_VTY_NAME "bgpd.vty" /* Check AS path loop when we send NLRI. */ /* #define BGP_SEND_ASPATH_CHECK */ |