net: fix netlink address dumping in IPv4/IPv6
authorPatrick McHardy <kaber@trash.net>
Sat, 27 Mar 2010 03:27:49 +0000 (20:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Mar 2010 03:27:49 +0000 (20:27 -0700)
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: Pawel Staszewski <pstaszewski@itcare.pl>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv4/devinet.c
net/ipv6/addrconf.c

index 51ca946e339268b58181870695906e1f29257d85..3feb2b39030838ca08fb02e0b0063711b34e76b2 100644 (file)
@@ -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) {
                        if (idx < s_idx)
                                goto cont;
-                       if (idx > s_idx)
+                       if (h > s_h || idx > s_idx)
                                s_ip_idx = 0;
                        in_dev = __in_dev_get_rcu(dev);
                        if (!in_dev)
index 3381b4317c270230a7c44ee7d57daf6ac4345897..7e567ae5eaab052d482a296db7ff4457114eef78 100644 (file)
@@ -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) {
                        if (idx < s_idx)
                                goto cont;
-                       if (idx > s_idx)
+                       if (h > s_h || idx > s_idx)
                                s_ip_idx = 0;
                        ip_idx = 0;
                        if ((idev = __in6_dev_get(dev)) == NULL)