diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-02 07:07:59 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 17:13:40 +0200 |
commit | 139ddad8f12cf6dbf2993af196cc33476c2b79cf (patch) | |
tree | a98d9477653598b878e9e2b69123af80097a633b /zebra/zebra_nhg.c | |
parent | zebra: Resolved nh change, inc refcnt by rt refcnt (diff) | |
download | frr-139ddad8f12cf6dbf2993af196cc33476c2b79cf.tar.xz frr-139ddad8f12cf6dbf2993af196cc33476c2b79cf.zip |
zebra: Accept NULL value for updating route NHE
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>
Diffstat (limited to '')
-rw-r--r-- | zebra/zebra_nhg.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 436783065..04a11dfcb 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -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 */ |