zebra: Make nexthop group vrf VRF_DEFAULT

Nexthop groups can have nexthops in different vrf's. So,
let's make the group vrf_id just be VRF_DEFAULT for hash
lookup purposes.

Set vrf_id to be VRF_DEFAULT for every message. If its a new
nextop, set the vrf to be the appropriate thing, otherwise
its a group and can just be left as default.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-03-22 14:00:25 -04:00
parent 8e401b251f
commit 55eeb2ae7f

View File

@ -2247,6 +2247,7 @@ int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
uint32_t id; uint32_t id;
unsigned char family; unsigned char family;
afi_t afi = AFI_UNSPEC; afi_t afi = AFI_UNSPEC;
vrf_id_t vrf_id = VRF_DEFAULT;
struct interface *ifp = NULL; struct interface *ifp = NULL;
struct nhmsg *nhm = NULL; struct nhmsg *nhm = NULL;
/* struct for nexthop group abstraction */ /* struct for nexthop group abstraction */
@ -2332,7 +2333,7 @@ int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (nhm->nh_flags & RTNH_F_ONLINK) if (nhm->nh_flags & RTNH_F_ONLINK)
SET_FLAG(nh->flags, SET_FLAG(nh->flags,
NEXTHOP_FLAG_ONLINK); NEXTHOP_FLAG_ONLINK);
vrf_id = nh->vrf_id;
nexthop_group_add_sorted(nhg, nh); nexthop_group_add_sorted(nhg, nh);
} else { } else {
flog_warn( flog_warn(
@ -2363,8 +2364,8 @@ int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
} else { } else {
/* This is a new nexthop group */ /* This is a new nexthop group */
nhe = zebra_nhg_find(nhg, nhg->nexthop->vrf_id, afi, id, nhe = zebra_nhg_find(nhg, vrf_id, afi, id, nhg_depends,
nhg_depends, dep_count); dep_count);
if (!nhe) { if (!nhe) {
flog_err( flog_err(
EC_ZEBRA_TABLE_LOOKUP_FAILED, EC_ZEBRA_TABLE_LOOKUP_FAILED,