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 /zebra | |
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 'zebra')
-rw-r--r-- | zebra/Makefile.am | 2 | ||||
-rw-r--r-- | zebra/main.c | 13 | ||||
-rw-r--r-- | zebra/test_main.c | 11 | ||||
-rw-r--r-- | zebra/zserv.h | 4 |
4 files changed, 23 insertions, 7 deletions
diff --git a/zebra/Makefile.am b/zebra/Makefile.am index 542f36f4..828e88ff 100644 --- a/zebra/Makefile.am +++ b/zebra/Makefile.am @@ -1,7 +1,7 @@ ## 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)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@ +DEFS = @DEFS@ -DMULTIPATH_NUM=@MULTIPATH_NUM@ INSTALL_SDATA=@INSTALL@ -m 600 LIB_IPV6 = @LIB_IPV6@ diff --git a/zebra/main.c b/zebra/main.c index d829c046..293e22b8 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" @@ -108,10 +109,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 @@ -300,6 +304,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 +396,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); diff --git a/zebra/test_main.c b/zebra/test_main.c index 70a1a3a6..4e1002e8 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -29,6 +29,7 @@ #include "log.h" #include "privs.h" #include "sigevent.h" +#include "paths.h" #include "zebra/rib.h" #include "zebra/zserv.h" @@ -73,10 +74,13 @@ zebra_capabilities_t _caps_p [] = }; /* 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 @@ -276,6 +280,9 @@ main (int argc, char **argv) usage (progname, 1); } + 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 (); diff --git a/zebra/zserv.h b/zebra/zserv.h index a7371830..cccd9be0 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -30,7 +30,9 @@ #define ZEBRA_VTY_PORT 2601 /* Default configuration filename. */ -#define DEFAULT_CONFIG_FILE "zebra.conf" +#define ZEBRA_CONFIG_NAME "zebra.conf" +#define ZEBRA_PID_NAME "zebra.pid" +#define ZEBRA_VTY_NAME "zebra.vty" /* Client structure. */ struct zserv |