]> git.puffer.fish Git - mirror/frr.git/commitdiff
Quagga: Fixup decision about what an unnumbered interface is
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 20 Nov 2015 15:10:47 +0000 (07:10 -0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 20 Nov 2015 15:10:47 +0000 (07:10 -0800)
This Change modifies what zebra thinks is an unnumbered interface.
If the interface is not a loopback and the prefixlength for the
interface is 32 than consider this an unnumbered interface.

Ticket: CM-8016
Reviewed by: CCR-3827
Testing: Full Regression Suites

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/if.c
lib/if.h
zebra/connected.c
zebra/interface.c

index b192d48e208f10ae0eb0f3efb80f8149df653cf5..d4bd918e955753e4eab7a1889cbe0c31c1e8597c 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -383,36 +383,6 @@ if_lookup_address (void *matchaddr, int family)
   return if_lookup_address_vrf (matchaddr, family, VRF_DEFAULT);
 }
 
-/* Lookup anchor interface by IPv4 address. */
-struct connected *
-if_anchor_lookup_by_address (struct in_addr src)
-{
-  struct listnode *node;
-  struct listnode *cnode;
-  struct interface *ifp;
-  struct prefix *p;
-  struct connected *c;
-
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
-    {
-      for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
-        {
-          if (CHECK_FLAG(c->flags, ZEBRA_IFA_UNNUMBERED) ||
-              !CHECK_FLAG(c->conf, ZEBRA_IFC_REAL))
-            continue;
-
-          p = c->address;
-
-          if (p && p->family == AF_INET)
-            {
-              if (IPV4_ADDR_SAME (&p->u.prefix4, &src))
-                return c;
-            }
-        }
-    }
-  return NULL;
-}
-
 /* Lookup interface by prefix */
 struct interface *
 if_lookup_prefix_vrf (struct prefix *prefix, vrf_id_t vrf_id)
index 05803d01adca2e1913d2224cd4d2bf6d02f444dc..f7a5a5ceefc63bb1345ae5af2a35f512b5a259e9 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -190,12 +190,6 @@ struct connected
      Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */
   struct prefix *destination;
 
-  /* A list of unnumbered IFCs borrowing the address from me */
-  struct list *unnumbered;
-
-  /* Pointer to the anchor IFC if I'm unnumbered */
-  struct connected *anchor;
-
   /* Label for Linux 2.2.X and upper. */
   char *label;
 };
@@ -271,7 +265,6 @@ extern struct interface *if_lookup_by_index (unsigned int);
 extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
 extern struct interface *if_lookup_address (void *matchaddr, int family);
 extern struct interface *if_lookup_prefix (struct prefix *prefix);
-extern struct connected *if_anchor_lookup_by_address (struct in_addr src);
 
 extern struct interface *if_create_vrf (const char *name, int namelen,
                                 vrf_id_t vrf_id);
index b6dbad39bd27b0f59b1bc3155c0a087a8f9e252c..b9ab3e13b58004556ef7b3f27198a256a92f5a36 100644 (file)
@@ -79,20 +79,12 @@ connected_announce (struct interface *ifp, struct connected *ifc)
   if (!ifc)
     return;
 
-  if (ifc->address->family == AF_INET)
+  if (!if_is_loopback(ifp) && ifc->address->family == AF_INET)
     {
-      if ((ifc->anchor = if_anchor_lookup_by_address(ifc->address->u.prefix4)))
-       {
-         /* found an anchor, so I'm unnumbered */
+      if (ifc->address->prefixlen == 32)
          SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
-         listnode_add (ifc->anchor->unnumbered, ifc);
-       }
       else
-       {
-         /* I'm numbered */
          UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
-         ifc->unnumbered = list_new();
-       }
     }
 
   listnode_add (ifp->connected, ifc);
@@ -339,42 +331,6 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
   rib_update_static (ifp->vrf_id);
 }
 
-void
-connected_delete_ipv4_unnumbered (struct connected *ifc)
-{
-  struct connected *new_anchor, *iter;
-  struct listnode *node;
-
-  if (CHECK_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED))
-    {
-      listnode_delete (ifc->anchor->unnumbered, ifc);
-      ifc->anchor = NULL;
-    }
-  else /* I'm a numbered interface */
-    {
-      if (!list_isempty (ifc->unnumbered))
-        {
-          new_anchor = listgetdata (listhead (ifc->unnumbered));
-          new_anchor->unnumbered = ifc->unnumbered;
-          listnode_delete (new_anchor->unnumbered, new_anchor);
-          new_anchor->anchor = NULL;
-
-          /* new_anchor changed from unnumbered to numbered, notify clients */
-          zebra_interface_address_delete_update (new_anchor->ifp, new_anchor);
-          UNSET_FLAG (new_anchor->flags, ZEBRA_IFA_UNNUMBERED);
-          zebra_interface_address_add_update (new_anchor->ifp, new_anchor);
-
-          for (ALL_LIST_ELEMENTS_RO(new_anchor->unnumbered, node, iter))
-            iter->anchor = new_anchor;
-        }
-      else
-        {
-          list_free (ifc->unnumbered);
-          ifc->unnumbered = NULL;
-        }
-    }
-}
-
 /* Delete connected IPv4 route to the interface. */
 void
 connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
@@ -392,8 +348,6 @@ connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
   if (! ifc)
     return;
 
-  connected_delete_ipv4_unnumbered (ifc);
-
   connected_withdraw (ifc);
 
   if (IS_ZEBRA_DEBUG_RIB)
index a3d297d327b6eba753a60e94ef1f0d59d0788ea0..a2d1c95b5620749757a1faf6f12517cb201413ab 100644 (file)
@@ -478,7 +478,6 @@ if_delete_update (struct interface *ifp)
 
                  UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
                  UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED);
-                  connected_delete_ipv4_unnumbered(ifc);
 
                  /* Remove from subnet chain. */
                  list_delete_node (addr_list, anode);