]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: only track NHEs from the dataplane for ID usage
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 12 Oct 2020 21:37:14 +0000 (17:37 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Tue, 13 Oct 2020 15:23:57 +0000 (11:23 -0400)
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>
zebra/zebra_nhg.c

index 1cd19f057582d824f815a98621db54124f7b7a16..f1f6e7e2bf882d5439855ca3e136e8e12ac6c002 100644 (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 {