summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2018-07-25 01:42:11 +0200
committerGitHub <noreply@github.com>2018-07-25 01:42:11 +0200
commit4dbd617abd7de8f53a0fecb763b95704341450af (patch)
treef89da1ab9340affc7b80823aa54f296f5b16e5dd
parentMerge pull request #2706 from chiragshah6/mdev (diff)
parentzebra: Add check for nexthop loop to prevent hanging (diff)
downloadfrr-4dbd617abd7de8f53a0fecb763b95704341450af.tar.xz
frr-4dbd617abd7de8f53a0fecb763b95704341450af.zip
Merge pull request #2704 from sworleys/Netlink-Nexthop-Hang
zebra: Add check for nexthop loop to prevent hanging
-rw-r--r--zebra/rt_netlink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 4fe42f2eb..80841b6ac 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -580,6 +580,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);
}
@@ -700,6 +703,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);
}