From: Christian Franke <nob...@nowhere.ws> Having an RTM_ADDROUTE with a rib == NULL would lead to a crash due to a NULL pointer dereference.
Since an RTM_ADDROUTE without a rib object doesn't make much sense, print a warning and remove the concerned route instead. Signed-off-by: Christian Franke <ch...@opensourcerouting.org> --- zebra/zebra_fpm_netlink.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 0173000..e2c6b8b 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -251,11 +251,16 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd, * An RTM_DELROUTE need not be accompanied by any nexthops, * particularly in our communication with the FPM. */ - if (cmd == RTM_DELROUTE && !rib) + if (cmd == RTM_DELROUTE) goto skip; - if (rib) - ri->rtm_protocol = netlink_proto_from_route_type (rib->type); + if (!rib) + { + zlog_err("netlink_route_info_fill RTM_ADDROUTE called without rib info"); + return 0; + } + + ri->rtm_protocol = netlink_proto_from_route_type (rib->type); if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT)) discard = 1; -- 2.8.0 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev