]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/interface.c
Merge remote-tracking branch 'origin/stable/3.0'
[mirror_frr.git] / zebra / interface.c
index 1eefe1339ce74998ffcd9219563208d5b50353dc..c3d303736204c1539415d335d8ef9b158f022190 100644 (file)
@@ -190,6 +190,7 @@ if_unlink_per_ns (struct interface *ifp)
 {
   ifp->node->info = NULL;
   route_unlock_node(ifp->node);
+  ifp->node = NULL;
 }
 
 /* Look up an interface by identifier within a NS */
@@ -210,6 +211,23 @@ if_lookup_by_index_per_ns (struct zebra_ns *ns, u_int32_t ifindex)
   return ifp;
 }
 
+/* Look up an interface by name within a NS */
+struct interface *
+if_lookup_by_name_per_ns (struct zebra_ns *ns, const char *ifname)
+{
+  struct route_node *rn;
+  struct interface *ifp;
+
+  for (rn = route_top (ns->if_table); rn; rn = route_next (rn))
+    {
+      ifp = (struct interface *)rn->info;
+      if (ifp && strcmp (ifp->name, ifname) == 0)
+       return (ifp);
+    }
+
+  return NULL;
+}
+
 const char *
 ifindex2ifname_per_ns (struct zebra_ns *zns, unsigned int ifindex)
 {