summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--bgpd/bgp_main.c5
-rw-r--r--isisd/isis_main.c7
-rw-r--r--lib/vty.c146
-rw-r--r--lib/vty.h2
-rw-r--r--ospf6d/ospf6_main.c3
-rw-r--r--ospfd/ospf_main.c3
-rw-r--r--ripd/rip_main.c5
-rw-r--r--ripngd/ripng_main.c5
-rw-r--r--zebra/main.c3
10 files changed, 82 insertions, 105 deletions
diff --git a/ChangeLog b/ChangeLog
index c4a71776..d2d86af8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-06-20 Hasso Tepper <hasso@estpak.ee>
+
+ * lib/vty.c: Don't attempt to load configuration file from current
+ directory.
+ * Update vty_read_config() calls in bgpd/bgp_main.c, isisd/isis_main.c,
+ ospf6d/ospf6_main.c, ospfd/ospf_main.c, ripd/rip_main.c,
+ ripngd/ripng_main.c and zebra/main.c.
+
2004-05-11 Paul Jakma <paul@dishone.st>
* configure.ac: Add solaris support for the zebra/*_solaris
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 54086e5b..a4cd9ab4 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -79,7 +79,6 @@ struct quagga_signal_t bgp_signals[] =
};
/* Configuration file and directory. */
-char config_current[] = BGP_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
/* Route retain mode flag. */
@@ -159,7 +158,7 @@ sighup (void)
zlog_info ("bgpd restarting!");
/* Reload config file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Create VTY's socket */
vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
@@ -287,7 +286,7 @@ main (int argc, char **argv)
sort_node ();
/* Parse config file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Turn into daemon if daemon_mode is set. */
if (daemon_mode)
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index e763a9e8..a2a7e51a 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -87,7 +87,6 @@ struct option longopts[] =
};
/* Configuration file and directory. */
-char config_current[] = ISISD_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR ISISD_DEFAULT_CONFIG;
char *config_file = NULL;
@@ -311,9 +310,9 @@ main (int argc, char **argv, char **envp)
/* parse config file */
/* this is needed three times! because we have interfaces before the areas */
- vty_read_config (config_file, config_current, config_default);
- vty_read_config (config_file, config_current, config_default);
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
+ vty_read_config (config_file, config_default);
+ vty_read_config (config_file, config_default);
/* demonize */
if (daemon_mode)
diff --git a/lib/vty.c b/lib/vty.c
index 4b23487d..761ca4c2 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2208,8 +2208,7 @@ vty_use_backup_config (char *fullpath)
/* Read up configuration file from file_name. */
void
vty_read_config (char *config_file,
- char *config_current_dir,
- char *config_default_dir)
+ char *config_default_dir)
{
char cwd[MAXPATHLEN];
FILE *confp = NULL;
@@ -2219,101 +2218,78 @@ vty_read_config (char *config_file,
if (config_file != NULL)
{
if (! IS_DIRECTORY_SEP (config_file[0]))
- {
- getcwd (cwd, MAXPATHLEN);
- fullpath = XMALLOC (MTYPE_TMP,
- strlen (cwd) + strlen (config_file) + 2);
- sprintf (fullpath, "%s/%s", cwd, config_file);
- }
+ {
+ getcwd (cwd, MAXPATHLEN);
+ fullpath = XMALLOC (MTYPE_TMP,
+ strlen (cwd) + strlen (config_file) + 2);
+ sprintf (fullpath, "%s/%s", cwd, config_file);
+ }
else
- fullpath = config_file;
+ fullpath = config_file;
confp = fopen (fullpath, "r");
if (confp == NULL)
- {
- confp = vty_use_backup_config (fullpath);
- if (confp)
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- else
- {
- fprintf (stderr, "can't open configuration file [%s]\n",
- config_file);
- exit(1);
- }
- }
+ {
+ confp = vty_use_backup_config (fullpath);
+ if (confp)
+ fprintf (stderr, "WARNING: using backup configuration file!\n");
+ else
+ {
+ fprintf (stderr, "can't open configuration file [%s]\n",
+ config_file);
+ exit(1);
+ }
+ }
}
else
{
- /* Relative path configuration file open. */
- if (config_current_dir)
- {
- confp = fopen (config_current_dir, "r");
- if (confp == NULL)
- {
- confp = vty_use_backup_config (config_current_dir);
- if (confp)
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- }
- }
-
- /* If there is no relative path exists, open system default file. */
- if (confp == NULL)
- {
#ifdef VTYSH
- int ret;
- struct stat conf_stat;
-
- /* !!!!PLEASE LEAVE!!!!
- This is NEEDED for use with vtysh -b, or else you can get
- a real configuration food fight with a lot garbage in the
- merged configuration file it creates coming from the per
- daemon configuration files. This also allows the daemons
- to start if there default configuration file is not
- present or ignore them, as needed when using vtysh -b to
- configure the daemons at boot - MAG */
-
- /* Stat for vtysh Zebra.conf, if found startup and wait for
- boot configuration */
-
- if ( strstr(config_default_dir, "vtysh") == NULL)
- {
- ret = stat (integrate_default, &conf_stat);
- if (ret >= 0)
- {
- return;
- }
- }
+ int ret;
+ struct stat conf_stat;
+
+ /* !!!!PLEASE LEAVE!!!!
+ * This is NEEDED for use with vtysh -b, or else you can get
+ * a real configuration food fight with a lot garbage in the
+ * merged configuration file it creates coming from the per
+ * daemon configuration files. This also allows the daemons
+ * to start if there default configuration file is not
+ * present or ignore them, as needed when using vtysh -b to
+ * configure the daemons at boot - MAG
+ */
+
+ /* Stat for vtysh Zebra.conf, if found startup and wait for
+ * boot configuration
+ */
+
+ if ( strstr(config_default_dir, "vtysh") == NULL)
+ {
+ ret = stat (integrate_default, &conf_stat);
+ if (ret >= 0)
+ return;
+ }
#endif /* VTYSH */
- confp = fopen (config_default_dir, "r");
- if (confp == NULL)
- {
- confp = vty_use_backup_config (config_default_dir);
- if (confp)
- {
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- fullpath = config_default_dir;
- }
- else
- {
- fprintf (stderr, "can't open configuration file [%s]\n",
- config_default_dir);
- exit (1);
- }
- }
- else
- fullpath = config_default_dir;
- }
+ confp = fopen (config_default_dir, "r");
+ if (confp == NULL)
+ {
+ confp = vty_use_backup_config (config_default_dir);
+ if (confp)
+ {
+ fprintf (stderr, "WARNING: using backup configuration file!\n");
+ fullpath = config_default_dir;
+ }
+ else
+ {
+ fprintf (stderr, "can't open configuration file [%s]\n",
+ config_default_dir);
+ exit (1);
+ }
+ }
else
- {
- /* Rleative path configuration file. */
- getcwd (cwd, MAXPATHLEN);
- fullpath = XMALLOC (MTYPE_TMP,
- strlen (cwd) + strlen (config_current_dir) + 2);
- sprintf (fullpath, "%s/%s", cwd, config_current_dir);
- }
- }
+ fullpath = config_default_dir;
+ }
+
vty_read_file (confp);
fclose (confp);
diff --git a/lib/vty.h b/lib/vty.h
index fedfb3ed..3cf9c4a2 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -192,7 +192,7 @@ void vty_reset (void);
void vty_finish (void);
struct vty *vty_new (void);
int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
-void vty_read_config (char *, char *, char *);
+void vty_read_config (char *, char *);
void vty_time_print (struct vty *, int);
void vty_serv_sock (const char *, unsigned short, char *);
void vty_close (struct vty *);
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index c22e90bb..ffdad10b 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -79,7 +79,6 @@ struct option longopts[] =
};
/* Configuration file and directory. */
-char config_current[] = OSPF6_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR OSPF6_DEFAULT_CONFIG;
/* ospf6d program name. */
@@ -291,7 +290,7 @@ main (int argc, char *argv[], char *envp[])
sort_node ();
/* parse config file */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
if (daemon_mode)
daemon (0, 0);
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 1ebc9e9e..7e1567ca 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -74,7 +74,6 @@ struct zebra_privs_t ospfd_privs =
};
/* Configuration filename and directory. */
-char config_current[] = OSPF_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR OSPF_DEFAULT_CONFIG;
/* OSPFd options. */
@@ -286,7 +285,7 @@ main (int argc, char **argv)
sort_node ();
/* Get configuration file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Change to the daemon program. */
if (daemon_mode)
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index 530b13c9..c2128e46 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -74,7 +74,6 @@ struct zebra_privs_t ripd_privs =
};
/* Configuration file and directory. */
-char config_current[] = RIPD_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR RIPD_DEFAULT_CONFIG;
char *config_file = NULL;
@@ -131,7 +130,7 @@ sighup (void)
zlog_info ("ripd restarting!");
/* Reload config file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Create VTY's socket */
vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH);
@@ -274,7 +273,7 @@ main (int argc, char **argv)
sort_node ();
/* Get configuration file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Change to the daemon program. */
if (daemon_mode)
diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c
index eea47566..92193788 100644
--- a/ripngd/ripng_main.c
+++ b/ripngd/ripng_main.c
@@ -38,7 +38,6 @@
#include "ripngd/ripngd.h"
/* Configuration filename and directory. */
-char config_current[] = RIPNG_DEFAULT_CONFIG;
char config_default[] = SYSCONFDIR RIPNG_DEFAULT_CONFIG;
char *config_file = NULL;
@@ -135,7 +134,7 @@ sighup (void)
zlog_info ("Terminating on signal");
/* Reload config file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Create VTY's socket */
vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH);
@@ -276,7 +275,7 @@ main (int argc, char **argv)
sort_node ();
/* Get configuration file. */
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Change to the daemon program. */
if (daemon_mode)
diff --git a/zebra/main.c b/zebra/main.c
index 3384d7dd..1083ae57 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -95,7 +95,6 @@ struct zebra_privs_t zserv_privs =
};
/* Default configuration file path. */
-char config_current[] = DEFAULT_CONFIG_FILE;
char config_default[] = SYSCONFDIR DEFAULT_CONFIG_FILE;
/* Process ID saved for use by init system */
@@ -317,7 +316,7 @@ main (int argc, char **argv)
rib_sweep_route ();
/* Configuration file read*/
- vty_read_config (config_file, config_current, config_default);
+ vty_read_config (config_file, config_default);
/* Clean up rib. */
rib_weed_tables ();