Skip to content

Commit 86f9bd1

Browse files
Jeff Barnhilldavem330
authored andcommitted
net/ipv6: Display all addresses in output of /proc/net/if_inet6
The backend handling for /proc/net/if_inet6 in addrconf.c doesn't properly handle starting/stopping the iteration. The problem is that at some point during the iteration, an overflow is detected and the process is subsequently stopped. The item being shown via seq_printf() when the overflow occurs is not actually shown, though. When start() is subsequently called to resume iterating, it returns the next item, and thus the item that was being processed when the overflow occurred never gets printed. Alter the meaning of the private data member "offset". Currently, when it is not 0 (which only happens at the very beginning), "offset" represents the next hlist item to be printed. After this change, "offset" always represents the current item. This is also consistent with the private data member "bucket", which represents the current bucket, and also the use of "pos" as defined in seq_file.txt: The pos passed to start() will always be either zero, or the most recent pos used in the previous session. Signed-off-by: Jeff Barnhill <0xeffeff@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f88b4c0 commit 86f9bd1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

net/ipv6/addrconf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,7 +4201,6 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos)
42014201
p++;
42024202
continue;
42034203
}
4204-
state->offset++;
42054204
return ifa;
42064205
}
42074206

@@ -4225,13 +4224,12 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq,
42254224
return ifa;
42264225
}
42274226

4227+
state->offset = 0;
42284228
while (++state->bucket < IN6_ADDR_HSIZE) {
4229-
state->offset = 0;
42304229
hlist_for_each_entry_rcu(ifa,
42314230
&inet6_addr_lst[state->bucket], addr_lst) {
42324231
if (!net_eq(dev_net(ifa->idev->dev), net))
42334232
continue;
4234-
state->offset++;
42354233
return ifa;
42364234
}
42374235
}

0 commit comments

Comments
 (0)