diff options
| author | Russ White <russ@riw.us> | 2022-01-24 07:33:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-24 07:33:53 -0500 |
| commit | bbf1101240f6097a9d2fbba9d50b83c11c36005b (patch) | |
| tree | 0d32a198719fd79c1b821ef475e8f201fbd1b60d | |
| parent | 6b968475ed9e7256df49a71dc4b7b8d49a9db17b (diff) | |
| parent | e4c5b3ba06fcd4f4b79a32ae9667aa33f49dcd1d (diff) | |
Merge pull request #10412 from idryzhov/zebra-vrf-delete
zebra: fix vrf deletion
| -rw-r--r-- | zebra/if_netlink.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 1c6c70ae84..141e4074d5 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1761,16 +1761,16 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) desc = (char *)RTA_DATA(tb[IFLA_IFALIAS]); } - /* If VRF, create or update the VRF structure itself. */ - if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns()) { - netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name); - vrf_id = (vrf_id_t)ifi->ifi_index; - } - /* See if interface is present. */ ifp = if_lookup_by_name_per_ns(zns, name); if (h->nlmsg_type == RTM_NEWLINK) { + /* If VRF, create or update the VRF structure itself. */ + if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns()) { + netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name); + vrf_id = (vrf_id_t)ifi->ifi_index; + } + if (tb[IFLA_MASTER]) { if (slave_kind && (strcmp(slave_kind, "vrf") == 0) && !vrf_is_backend_netns()) { @@ -2032,6 +2032,10 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) zebra_l2_vxlanif_del(ifp); if_delete_update(ifp); + + /* If VRF, delete the VRF structure itself. */ + if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns()) + netlink_vrf_change(h, tb[IFLA_LINKINFO], ns_id, name); } return 0; |
