]> git.puffer.fish Git - matthieu/frr.git/commit
zebra: null check re->nhe not re->nhe->nhg on attach
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 16 Dec 2019 21:37:14 +0000 (16:37 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Mon, 16 Dec 2019 21:37:14 +0000 (16:37 -0500)
commit84a89a8d2ef6c253c043fd724eec94fc456aab81
tree25be7aaa34a17315240c476825b26c0854390508
parent8887295390c5785b82922eeb5caba49da2f373d9
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>
zebra/zebra_rib.c