diff options
| author | Russ White <russ@riw.us> | 2018-09-11 11:33:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-11 11:33:27 -0400 |
| commit | 88f47ef36536a040b30652bc22c253e7c5bc1c2e (patch) | |
| tree | 272285fef5319101109e4148f7784155bebe5fdc /zebra/interface.c | |
| parent | 5297438f5976b9a4460b07866413dfb990957af2 (diff) | |
| parent | c3568c4d1a080bc0510894374e16c157be28e8e4 (diff) | |
Merge pull request #2944 from thbtcllt/master
fix zebra crash when a vrf interface changes with netns implementation for vrf
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 32ee1a566a..0c9e21d068 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -202,7 +202,6 @@ struct interface *if_link_per_ns(struct zebra_ns *ns, struct interface *ifp) if (rn->info) { ifp = (struct interface *)rn->info; route_unlock_node(rn); /* get */ - ifp->node = rn; return ifp; } @@ -253,30 +252,6 @@ 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; @@ -753,8 +728,12 @@ void if_delete_update(struct interface *ifp) ifp->node = NULL; /* if the ifp is in a vrf, move it to default so vrf can be deleted if - * desired */ - if (ifp->vrf_id) + * desired. This operation is not done for netns implementation to avoid + * collision with interface with the same name in the default vrf (can + * occur with this implementation whereas it is not possible with + * vrf-lite). + */ + if (ifp->vrf_id && !vrf_is_backend_netns()) if_handle_vrf_change(ifp, VRF_DEFAULT); /* Reset some zebra interface params to default values. */ |
