]> git.proxmox.com Git - mirror_frr.git/commitdiff
[interface configuration] Try to avoid losing address info after shutdown.
authorAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Sun, 21 May 2006 04:04:49 +0000 (04:04 +0000)
committerAndrew J. Schorr <ajschorr@alumni.princeton.edu>
Sun, 21 May 2006 04:04:49 +0000 (04:04 +0000)
2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

* if.h: (struct connected) Document the meaning of the
  ZEBRA_IFC_REAL and ZEBRA_IFC_CONFIGURED flags.
* connected.c: (connected_withdraw) Do not delete the connected
  address if the ZEBRA_IFC_CONFIGURED flag is set.
  (connected_add_ipv4,connected_add_ipv6) Before calling
  connected_withdraw, unset the ZEBRA_IFC_CONFIGURED flag
  on the superseded connected structure.

lib/ChangeLog
lib/if.h
zebra/ChangeLog
zebra/connected.c

index b54b7453387a4aa9d957afbf5310875fb242bb49..db3c546c636fa04e4a6284c4ea3ce0a679d89512 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * if.h: (struct connected) Document the meaning of the
+         ZEBRA_IFC_REAL and ZEBRA_IFC_CONFIGURED flags.
+
 2006-05-15 Paul Jakma <paul.jakma@sun.com>
 
        * log.c: (general) Generalise struct zebra_route_desc into
index 20df7ef16341e1b519a7beae23add634cdede11c..0a4ff14dabd96e5b6e26ed779ede538527ec7b5d 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -145,6 +145,12 @@ struct connected
   u_char conf;
 #define ZEBRA_IFC_REAL         (1 << 0)
 #define ZEBRA_IFC_CONFIGURED   (1 << 1)
+  /*
+     The ZEBRA_IFC_REAL flag should be set if and only if this address
+     exists in the kernel.
+     The ZEBRA_IFC_CONFIGURED flag should be set if and only if this address
+     was configured by the user from inside quagga.
+   */
 
   /* Flags for connected address. */
   u_char flags;
index 3ad0e83f1f98598f88cd50b155cebf52d50ac493..e70efaee6f966c0753572fc85333a63a7821a147 100644 (file)
@@ -1,3 +1,11 @@
+2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * connected.c: (connected_withdraw) Do not delete the connected
+         address if the ZEBRA_IFC_CONFIGURED flag is set.
+         (connected_add_ipv4,connected_add_ipv6) Before calling
+         connected_withdraw, unset the ZEBRA_IFC_CONFIGURED flag
+         on the superseded connected structure.
+
 2006-05-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * connected.c: (connected_add_ipv4,connected_add_ipv6) If the
index 39f47805182181128390886ef3998efd84cbafa5..37aa456af8baedc2bf29abf1171dac2356042932 100644 (file)
@@ -60,8 +60,11 @@ connected_withdraw (struct connected *ifc)
       UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
     }
 
-  listnode_delete (ifc->ifp->connected, ifc);
-  connected_free (ifc);
+  if (!CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED))
+    {
+      listnode_delete (ifc->ifp->connected, ifc);
+      connected_free (ifc);
+    }
 }
 
 static void
@@ -227,7 +230,10 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
   if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
     {
       if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
-       SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
+       {
+         SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
+         UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
+       }
       connected_withdraw (current); /* implicit withdraw - freebsd does this */
     }
   
@@ -370,7 +376,10 @@ connected_add_ipv6 (struct interface *ifp, struct in6_addr *addr,
   if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
     {
       if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
-       SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
+       {
+         SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
+         UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
+       }
       connected_withdraw (current); /* implicit update of existing address */
     }