diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-30 13:29:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 13:29:17 +0200 |
commit | 58df03afb1da1c2c0d1bc928a887bc51e2e2c236 (patch) | |
tree | a6a784c8229b49f956a8d69aab1210bdfefdc383 | |
parent | Merge pull request #6241 from volta-networks/fix_ldp_acl (diff) | |
parent | zebra: fix detection of VRF misconfiguration (diff) | |
download | frr-58df03afb1da1c2c0d1bc928a887bc51e2e2c236.tar.xz frr-58df03afb1da1c2c0d1bc928a887bc51e2e2c236.zip |
Merge pull request #6320 from opensourcerouting/fix-vrf-misconfig-detection
zebra: fix detection of VRF misconfiguration
-rw-r--r-- | zebra/if_netlink.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 17b6edfed..429bb968a 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -310,22 +310,25 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, nl_table_id = *(uint32_t *)RTA_DATA(attr[IFLA_VRF_TABLE]); if (h->nlmsg_type == RTM_NEWLINK) { - vrf_id_t exist_id; - if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("RTM_NEWLINK for VRF %s(%u) table %u", name, ifi->ifi_index, nl_table_id); - exist_id = vrf_lookup_by_table(nl_table_id, ns_id); - if (exist_id != VRF_DEFAULT) { - vrf = vrf_lookup_by_id(exist_id); + if (!vrf_lookup_by_id((vrf_id_t)ifi->ifi_index)) { + vrf_id_t exist_id; - flog_err( - EC_ZEBRA_VRF_MISCONFIGURED, - "VRF %s id %u table id overlaps existing vrf %s, misconfiguration exiting", - name, ifi->ifi_index, vrf->name); - exit(-1); + exist_id = vrf_lookup_by_table(nl_table_id, ns_id); + if (exist_id != VRF_DEFAULT) { + vrf = vrf_lookup_by_id(exist_id); + + flog_err( + EC_ZEBRA_VRF_MISCONFIGURED, + "VRF %s id %u table id overlaps existing vrf %s, misconfiguration exiting", + name, ifi->ifi_index, vrf->name); + exit(-1); + } } + /* * vrf_get is implied creation if it does not exist */ |