summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2018-09-12 11:33:51 -0700
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-09-18 10:41:53 -0400
commit520ebf72b27c2462ce8b0dc5a1d4cb83956df69c (patch)
treeaceba5b51cb3f7510efe328817eb419237bd7244 /zebra/interface.c
parent66e3798747385bbcd6cfbd647e1945718c565dd3 (diff)
zebra: resolve link dependencies post nldump
Netdevices are not sorted in any fashion by the kernel during the initial interface nldump. So you can get an upper device (such as an SVI) before its corresponding lower device (bridge). To fix this problem we skip resolving link dependencies during handling of nldump notifications. Resolving instead at the end (when all the devices are present) Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Ticket: CM-22388, CM-21796 Reviewed By: CCR-7845 Testing Done: 1. verified on a setup with missing linkages 2. automation - evpn-min
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index ca90c18cf2..9e43a5b53c 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -999,6 +999,37 @@ void zebra_if_update_link(struct interface *ifp, ifindex_t link_ifindex,
link_ifindex);
}
+/* during initial link dump kernel does not order lower devices before
+ * upper devices so we need to fixup link dependencies at the end of dump */
+void zebra_if_update_all_links(void)
+{
+ struct route_node *rn;
+ struct interface *ifp;
+ struct zebra_if *zif;
+ struct zebra_ns *ns;
+
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_info("fixup link dependencies");
+
+ ns = zebra_ns_lookup(NS_DEFAULT);
+ for (rn = route_top(ns->if_table); rn; rn = route_next(rn)) {
+ ifp = (struct interface *)rn->info;
+ if (!ifp)
+ continue;
+ zif = ifp->info;
+ if ((zif->link_ifindex != IFINDEX_INTERNAL) && !zif->link) {
+ zif->link = if_lookup_by_index_per_ns(ns,
+ zif->link_ifindex);
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug("interface %s/%d's lower fixup to %s/%d",
+ ifp->name, ifp->ifindex,
+ zif->link?zif->link->name:"unk",
+ zif->link_ifindex);
+ }
+ }
+}
+
+
/* Output prefix string to vty. */
static int prefix_vty_out(struct vty *vty, struct prefix *p)