[PATCH] neighbour.c, pneigh_get_next() skips published entry

From: Jari Takkala
Date: Thu May 11 2006 - 12:28:42 EST


The following patch fixes a problem where output from /proc/net/arp
skips a record when the full output does not fit into the users read()
buffer.

To reproduce: publish a large number of ARP entries (more than 10
required on my system). Run 'dd if=/proc/net/arp of=arp-1024.out
bs=1024'. View the output, one entry will be missing.

Please review and commit if acceptable.

Signed-off-by: Jari Takkala <jari.takkala@xxxxxx>

--- linux-2.6.16.15.orig/net/core/neighbour.c 2006-05-09
15:53:30.000000000 -0400
+++ linux-2.6.16.15/net/core/neighbour.c 2006-05-10
16:06:40.000000000 -0400
@@ -2120,6 +2120,11 @@
struct neigh_seq_state *state = seq->private;
struct neigh_table *tbl = state->tbl;

+ if (pos != NULL && *pos == 1 && (pn->next ||
tbl->phash_buckets[state->bucket])) {
+ --(*pos);
+ return pn;
+ }
+
pn = pn->next;
while (!pn) {
if (++state->bucket > PNEIGH_HASHMASK)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/