]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/interface.c
Merge pull request #3020 from donaldsharp/global_5549
[mirror_frr.git] / zebra / interface.c
index 95a8bd870bd8e054b4608eb792ad2d57a6a3b8e0..96b244635df98c7f3c7117285adce4914604d939 100644 (file)
@@ -1032,6 +1032,39 @@ 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)