]> git.proxmox.com Git - mirror_frr.git/commitdiff
+ fixed bug #402: now the second zebra process doesn't destroy routes
authorDenis Ovsienko <linux@pilot.org.ua>
Fri, 14 Sep 2007 13:31:52 +0000 (13:31 +0000)
committerDenis Ovsienko <linux@pilot.org.ua>
Fri, 14 Sep 2007 13:31:52 +0000 (13:31 +0000)
  of the first one before dying
+ we are not going to receive routing messages originated by old_pid,
  because rib_sweep_route() is called after damon() now. This will allow
  to drop old_pid completely soon.

zebra/ChangeLog
zebra/main.c

index 36d194aa5404f3d5b45d79ca260bd96126f6dd98..3d5dfd47290a33cb8f1584ef4cd927432e82841d 100644 (file)
@@ -5,6 +5,8 @@
          appropriate for sparse code-spaces (#401).
        * kernel_socket.c: (rtm_read, rtmsg_debug): Idem.
        * kernel_socket.[ch]: We don't need rtm_type_str_max any more.
+       * main.c: (main) Don't call rib_sweep_route() before the
+         pidfile is acquired, this fixes bug #402.
 
 2007-09-12 Denis Ovsienko
 
index 7d895799b42e4648a0157b25e1f19dfb25ec83f1..2f9665237ca7d6d4485d7020db93575c6274b932 100644 (file)
@@ -346,11 +346,13 @@ main (int argc, char **argv)
   zebra_snmp_init ();
 #endif /* HAVE_SNMP */
 
-  /* Clean up self inserted route. */
-  if (! keep_kernel_mode)
-    rib_sweep_route ();
-
-  /* Configuration file read*/
+  /* Process the configuration file. Among other configuration
+  *  directives we can meet those installing static routes. Such
+  *  requests will not be executed immediately, but queued in
+  *  zebra->ribq structure until we enter the main execution loop.
+  *  The notifications from kernel will show originating PID equal
+  *  to that after daemon() completes (if ever called).
+  */
   vty_read_config (config_file, config_default);
 
   /* Don't start execution if we are in dry-run mode */
@@ -374,6 +376,17 @@ main (int argc, char **argv)
   /* Output pid of zebra. */
   pid_output (pid_file);
 
+  /* After we have successfully acquired the pidfile, we can be sure
+  *  about being the only copy of zebra process, which is submitting
+  *  changes to the FIB.
+  *  Clean up zebra-originated routes. The requests will be sent to OS
+  *  immediately, so originating PID in notifications from kernel
+  *  will be equal to the current getpid(). To know about such routes,
+  * we have to have route_read() called before.
+  */
+  if (! keep_kernel_mode)
+    rib_sweep_route ();
+
   /* Needed for BSD routing socket. */
   pid = getpid ();