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 <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2020-10-12 17:37:14 -04:00
parent 5588801e7a
commit 475852b263

View File

@ -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 {