From 475852b263083f8ab2efda85a74c6ac1f516c03c Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Mon, 12 Oct 2020 17:37:14 -0400 Subject: [PATCH] zebra: only track NHEs from the dataplane for ID usage Let's just track the NHEs we get from the kernel(dplane) for ID usage with internal routes. I tried to be smart originally and allow them to be re-used internal to zebra but its proving to cause more bugs than it's worth. This doesn't break any functionality. It just means we won't use NHEs we get from the kernel with our routes, we will create new ones. Decided this based on various bugs seen ith the lastest one being on startup with this kernel state: ``` [root@alfred frr-2]# ip next ls id 15 via 192.168.161.1 dev doof scope link proto zebra id 17 group 15 proto zebra [root@alfred frr-2]# ip ro show 3.3.3.1 3.3.3.1 nhid 17 via 192.168.161.1 dev doof ``` Signed-off-by: Stephen Worley --- zebra/zebra_nhg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 1cd19f0575..f1f6e7e2bf 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -706,7 +706,7 @@ static bool zebra_nhe_find(struct nhg_hash_entry **nhe, /* return value */ if (lookup->id == 0) lookup->id = nhg_get_next_id(); - if (lookup->id < ZEBRA_NHG_PROTO_LOWER) { + if (!from_dplane && lookup->id < ZEBRA_NHG_PROTO_LOWER) { /* * This is a zebra hashed/owned NHG. * @@ -716,7 +716,8 @@ static bool zebra_nhe_find(struct nhg_hash_entry **nhe, /* return value */ zebra_nhg_insert_id(newnhe); } else { /* - * This is upperproto owned NHG and should not be hashed to. + * This is upperproto owned NHG or one we read in from dataplane + * and should not be hashed to. * * It goes in ID table. */ @@ -856,7 +857,7 @@ static bool zebra_nhg_find(struct nhg_hash_entry **nhe, uint32_t id, lookup.nhg = *nhg; lookup.vrf_id = vrf_id; - if (lookup.nhg.nexthop->next) { + if (nhg_depends || lookup.nhg.nexthop->next) { /* Groups can have all vrfs and AF's in them */ lookup.afi = AFI_UNSPEC; } else { -- 2.39.5