Commit 4b97efdf authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

net: fix netlink address dumping in IPv4/IPv6

When a dump is interrupted at the last device in a hash chain and
then continued, "idx" won't get incremented past s_idx, so s_ip_idx
is not reset when moving on to the next device. This means of all
following devices only the last n - s_ip_idx addresses are dumped.
Tested-by: default avatarPawel Staszewski <pstaszewski@itcare.pl>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent ac90a149
...@@ -1194,7 +1194,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1194,7 +1194,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
hlist_for_each_entry_rcu(dev, node, head, index_hlist) { hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
if (idx < s_idx) if (idx < s_idx)
goto cont; goto cont;
if (idx > s_idx) if (h > s_h || idx > s_idx)
s_ip_idx = 0; s_ip_idx = 0;
in_dev = __in_dev_get_rcu(dev); in_dev = __in_dev_get_rcu(dev);
if (!in_dev) if (!in_dev)
......
...@@ -3610,7 +3610,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, ...@@ -3610,7 +3610,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
hlist_for_each_entry_rcu(dev, node, head, index_hlist) { hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
if (idx < s_idx) if (idx < s_idx)
goto cont; goto cont;
if (idx > s_idx) if (h > s_h || idx > s_idx)
s_ip_idx = 0; s_ip_idx = 0;
ip_idx = 0; ip_idx = 0;
if ((idev = __in6_dev_get(dev)) == NULL) if ((idev = __in6_dev_get(dev)) == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment