net: fix missing pneigh entries in the neighbor seq_file code
authorChris Larson <clarson@mvista.com>
Sun, 3 Aug 2008 08:10:55 +0000 (01:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 3 Aug 2008 08:10:55 +0000 (01:10 -0700)
commit745e203164a9057e0de769ff4649e6e455daf753
tree477d9342196113fdbbeceebcbf4968aafe463646
parentbff69732c9947f821a64a8477f7dcaa9c30e6a69
net: fix missing pneigh entries in the neighbor seq_file code

When pneigh entries exist, but the user's read buffer isn't sufficient to
hold them all, one of the pneigh entries will be missing from the results.

In neigh_get_idx_any, the number of elements which neigh_get_idx
encountered is not correctly subtracted from the position number before
the call to pneigh_get_idx.  neigh_get_idx reduces the position by 1 for
each call to neigh_get_next, but it does not reduce it by one for the
first element (neigh_get_first). The patch alters the neigh_get_idx and
pneigh_get_idx functions to subtract one from pos, for the first element,
when pos is non-zero.

Signed-off-by: Chris Larson <clarson@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c