Merge pull request #2704 from sworleys/Netlink-Nexthop-Hang

zebra: Add check for nexthop loop to prevent hanging
This commit is contained in:
Russ White 2018-07-24 19:42:11 -04:00 committed by GitHub
commit 4dbd617abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -580,6 +580,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
route_entry_nexthop_ifindex_add( route_entry_nexthop_ifindex_add(
re, index, nh_vrf_id); re, index, nh_vrf_id);
if (rtnh->rtnh_len == 0)
break;
len -= NLMSG_ALIGN(rtnh->rtnh_len); len -= NLMSG_ALIGN(rtnh->rtnh_len);
rtnh = RTNH_NEXT(rtnh); rtnh = RTNH_NEXT(rtnh);
} }
@ -700,6 +703,9 @@ static int netlink_route_change_read_multicast(struct nlmsghdr *h,
oif[oif_count] = rtnh->rtnh_ifindex; oif[oif_count] = rtnh->rtnh_ifindex;
oif_count++; oif_count++;
if (rtnh->rtnh_len == 0)
break;
len -= NLMSG_ALIGN(rtnh->rtnh_len); len -= NLMSG_ALIGN(rtnh->rtnh_len);
rtnh = RTNH_NEXT(rtnh); rtnh = RTNH_NEXT(rtnh);
} }