summaryrefslogtreecommitdiffstats
path: root/zebra/connected.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:58:13 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:58:13 +0200
commit525c183906c47c491611f294db218d53a561a3b9 (patch)
treebe3eae87696fd7713622a0df97a591d37686282d /zebra/connected.c
parentonlink commit from Quagga-RE branch (diff)
downloadfrr-525c183906c47c491611f294db218d53a561a3b9.tar.xz
frr-525c183906c47c491611f294db218d53a561a3b9.zip
Unnumbered interface support.
Diffstat (limited to 'zebra/connected.c')
-rw-r--r--zebra/connected.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 4d6224cc9..ef1792c2f 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. */
@@ -314,6 +330,42 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
rib_update ();
}
+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,
@@ -330,7 +382,9 @@ connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
ifc = connected_check (ifp, (struct prefix *) &p);
if (! ifc)
return;
-
+
+ connected_delete_ipv4_unnumbered (ifc);
+
connected_withdraw (ifc);
rib_update();