diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-12-16 16:37:14 -0500 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-12-16 16:37:14 -0500 |
| commit | 84a89a8d2ef6c253c043fd724eec94fc456aab81 (patch) | |
| tree | 25be7aaa34a17315240c476825b26c0854390508 /zebra/zebra_rib.c | |
| parent | 8887295390c5785b82922eeb5caba49da2f373d9 (diff) | |
zebra: null check re->nhe not re->nhe->nhg on attach
We should be NULL checking the entire re->nhe struct, not
the group inside of it. When we get routes from the kernel
using a nexthop group (and future protocols) they will only
pass us an ID to use. Hence, this struct can (and will be)
NULL on first attach when only passed an ID.
There shouldn't be a situation where we have an re->nhe
and don't have an re->nhe->nhg anyway.
Before this patch you can easily make zebra crash by creating a
route in the kernel using a nexthop group and starting zebra.
`ip next add dev lo id 111`
`ip route add 1.1.1.1/32 nhid 111`
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index f375036db2..309b0f4301 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -228,7 +228,7 @@ int route_entry_update_nhe(struct route_entry *re, struct nhg_hash_entry *new) if (old) zebra_nhg_decrement_ref(old); - } else if (!re->nhe->nhg) + } else if (!re->nhe) /* This is the first time it's being attached */ route_entry_attach_ref(re, new); |
