diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2018-07-24 00:33:53 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2018-07-24 00:51:26 +0200 |
commit | 3c04071d996f84f265776f068ff21dc48d895139 (patch) | |
tree | a9bb8271bfa401f3a0b84ca8a3cf325a7e74c003 /zebra | |
parent | Merge pull request #2698 from sworleys/Netlink-Filter-AFI (diff) | |
download | frr-3c04071d996f84f265776f068ff21dc48d895139.tar.xz frr-3c04071d996f84f265776f068ff21dc48d895139.zip |
zebra: Add check for nexthop loop to prevent hanging
Bad nexthop messages from netlink were causing zebra
to hang here. Added a check to verify the length
of the nexthop so it doesn't keep trying to read.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/rt_netlink.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b346247d4..ec84c4c62 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -581,6 +581,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, route_entry_nexthop_ifindex_add( re, index, nh_vrf_id); + if (rtnh->rtnh_len == 0) + break; + len -= NLMSG_ALIGN(rtnh->rtnh_len); rtnh = RTNH_NEXT(rtnh); } @@ -701,6 +704,9 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h, oif[oif_count] = rtnh->rtnh_ifindex; oif_count++; + if (rtnh->rtnh_len == 0) + break; + len -= NLMSG_ALIGN(rtnh->rtnh_len); rtnh = RTNH_NEXT(rtnh); } |