]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Accept NULL value for updating route NHE
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 2 Jul 2019 05:07:59 +0000 (01:07 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:40 +0000 (11:13 -0400)
When updating a route's referenced NHE, accept a NULL value
as valid and clear out the pointer in the struct.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index 436783065d7f9a7423adb1866259edc488461286..04a11dfcb6597a17ee81f9d67b814c490db7a8d5 100644 (file)
@@ -1447,9 +1447,12 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
 int zebra_nhg_re_update_ref(struct route_entry *re, struct nhg_hash_entry *new)
 {
        struct nhg_hash_entry *old = NULL;
+       int ret = 0;
 
-       if (!new)
-               return -1;
+       if (new == NULL) {
+               re->ng = NULL;
+               goto done;
+       }
 
        if (re->nhe_id != new->id) {
                old = zebra_nhg_lookup_id(re->nhe_id);
@@ -1462,7 +1465,8 @@ int zebra_nhg_re_update_ref(struct route_entry *re, struct nhg_hash_entry *new)
                        zebra_nhg_decrement_ref(old);
        }
 
-       return 0;
+done:
+       return ret;
 }
 
 /* Convert a nhe into a group array */