On Tue, 29 Sep 2015, Donald Sharp wrote:

diff --git a/lib/if.h b/lib/if.h
index ad85dca..18b40c0 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -90,7 +90,7 @@ struct interface
#define ZEBRA_INTERFACE_ACTIVE     (1 << 0)
#define ZEBRA_INTERFACE_SUB        (1 << 1)
#define ZEBRA_INTERFACE_LINKDETECTION (1 << 2)
-
+
  /* Interface flags. */
  uint64_t flags;

@@ -169,6 +169,7 @@ struct connected
  u_char flags;
#define ZEBRA_IFA_SECONDARY    (1 << 0)
#define ZEBRA_IFA_PEER         (1 << 1)
+#define ZEBRA_IFA_UNNUMBERED   (1 << 2)
  /* N.B. the ZEBRA_IFA_PEER flag should be set if and only if
     a peer address has been configured.  If this flag is set,
     the destination field must contain the peer address.
@@ -183,6 +184,12 @@ 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;
+

Are these two fields mutually exclusive? If so, should they perhaps be in a union?


diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 2704100..b234c27 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -373,6 +373,40 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route 
*or)
      /* Nexthop, ifindex, distance and metric information. */
      for (ALL_LIST_ELEMENTS_RO (or->paths, node, path))
        {
+#ifdef HAVE_NETLINK

That can't be right? Part of the point of ZServ is to abstract the OS details a bit. The onlink patch isn't conditional this way.

diff --git a/zebra/connected.c b/zebra/connected.c
index 244f291..0fe0915 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -77,7 +77,23 @@ connected_announce (struct interface *ifp, struct connected 
*ifc)
{
  if (!ifc)
    return;
-
+
+  if (ifc->address->family == AF_INET)
+    {
+      if ((ifc->anchor = if_anchor_lookup_by_address(ifc->address->u.prefix4)))
+      {
+        /* found an anchor, so I'm unnumbered */
+        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);

  /* Update interface address information to protocol daemon. */
@@ -313,6 +329,42 @@ connected_down_ipv4 (struct interface *ifp, struct 
connected *ifc)
  rib_update (ifp->vrf_id);
}

+void
+connected_delete_ipv4_unnumbered (struct connected *ifc)

Hmm, that's not ideal either, is it? If it was just an internal helper, fine, but...

diff --git a/zebra/interface.c b/zebra/interface.c
index 14c3e78..7fb1d67 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -471,6 +471,7 @@ 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);

Hmm, I'm not sure this is right, or at least, ideal.

The interface has an address right, and we persumably get a DELADDR message when it's deleted before the interface delete message? Why hasn't it been deleted from the connected_delete_* path, driven by kernel deleting the message? (As an earlier version of this patch did?).

What do the kernel events sent on netlink look like?

regards,
--
Paul Jakma      [email protected]  @pjakma Key ID: 64A2FF6A
Fortune:
Do not seek death; death will find you.  But seek the road which makes death
a fulfillment.
                -- Dag Hammarskjold

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to