]> git.puffer.fish Git - mirror/frr.git/commitdiff
Removing code which looked at current dir for config file before attempting
authorhasso <hasso>
Sun, 20 Jun 2004 19:54:37 +0000 (19:54 +0000)
committerhasso <hasso>
Sun, 20 Jun 2004 19:54:37 +0000 (19:54 +0000)
to read system one.

ChangeLog
bgpd/bgp_main.c
isisd/isis_main.c
lib/vty.c
lib/vty.h
ospf6d/ospf6_main.c
ospfd/ospf_main.c
ripd/rip_main.c
ripngd/ripng_main.c
zebra/main.c

index c4a71776060c912539c5c2bc01a8bd51851b2d29..d2d86af8df9fdbada5aa7e0080201ac271f73e3e 100644 (file)
--- 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 
index 54086e5b2bb0d48bb4444f00362c6c4d5b6bb989..a4cd9ab4890b9ced90bb8cd6ec59e379eeb28f42 100644 (file)
@@ -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)
index e763a9e807335e9f16265ce91bbd523ffb2209ba..a2a7e51a96898a9be1d426b66b7479dd8bb3ff99 100644 (file)
@@ -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)
index 4b23487d8ed09e3e254cc77397ace43a1992dcad..761ca4c2148919f3d1ed50c6cff63f84af3108ca 100644 (file)
--- 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);
index fedfb3ed43ad277dc999f08347ad340b412a8e44..3cf9c4a2111efd5ba7a3ab72146f8d028b97b363 100644 (file)
--- 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 *);
index c22e90bbcdb6e4e3e15a810942516d68d5cb03f6..ffdad10b75e0ef885dda7790e43553f411d923d7 100644 (file)
@@ -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);
index 1ebc9e9eeda8677d60b21c2ede7850aa866a4245..7e1567ca8b93c34fb299727b3b432ba35b053323 100644 (file)
@@ -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)
index 530b13c95965466ac8516a524d8429082b0a925a..c2128e4696c1cdbc63a92fccdbaf4fda3fa13b2d 100644 (file)
@@ -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)
index eea47566bc364c63799888fbe2f274136ca546a1..921937882922f62edaa5c5289b6f8687a0d8f3b3 100644 (file)
@@ -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)
index 3384d7dd8830e39dfea0b03797b29efe7436600d..1083ae579ed820e6769c5dcc54ab2a1449a8cc64 100644 (file)
@@ -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 ();