diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-03-16 18:37:08 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-03-26 11:31:44 +0200 |
| commit | b53686c52a592e5edf0d89f92ec9a2b83fc4e470 (patch) | |
| tree | cfc0bc358e530995a32209de8b1b54d1334b7049 /zebra/interface.c | |
| parent | fc9aa7acdc3eb3501aff2af5548defb52ae77733 (diff) | |
zebra: delete interface that disappeared
When moving interfaces to an other place, like other netns, the
remaining interface is still present, with inactive status.
Now, that interface is deleted from the list, if the interface appears
on an other netns. If not, the interface is kept.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 01283f9122..8d3639b315 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -252,6 +252,30 @@ struct interface *if_lookup_by_name_per_ns(struct zebra_ns *ns, return NULL; } +/* this function must be used only if the vrf backend + * is a netns backend + */ +struct interface *if_lookup_by_name_not_ns(ns_id_t ns_id, + const char *ifname) +{ + struct interface *ifp; + struct ns *ns; + + RB_FOREACH (ns, ns_head, &ns_tree) { + if (ns->ns_id == ns_id) + continue; + /* if_delete_update has removed interface + * from zns->if_table + * so to look for interface, use the vrf list + */ + ifp = if_lookup_by_name(ifname, (vrf_id_t)ns->ns_id); + if (!ifp) + continue; + return ifp; + } + return NULL; +} + const char *ifindex2ifname_per_ns(struct zebra_ns *zns, unsigned int ifindex) { struct interface *ifp; |
