]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Add check for nexthop loop to prevent hanging 2704/head
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 23 Jul 2018 22:33:53 +0000 (18:33 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Mon, 23 Jul 2018 22:51:26 +0000 (18:51 -0400)
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>
zebra/rt_netlink.c

index b346247d4b5a3de297f0a804bcfb26976f46b092..ec84c4c622720f67f15cb18e3e4779aa5aa49e6f 100644 (file)
@@ -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);
                }