mirror of
https://github.com/torvalds/linux.git
synced 2026-06-10 07:32:29 +02:00
net: neighbour: fix neigh_dump_info()
[ Upstream commit 4bd6683bd4 ]
Denys found out "ip neigh" output was truncated to
about 54 neighbours.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Denys Fedoryshchenko <denys@visp.net.lb>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3d5f5b08fa
commit
217fc83322
|
|
@ -2214,9 +2214,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
|||
rcu_read_lock_bh();
|
||||
nht = rcu_dereference_bh(tbl->nht);
|
||||
|
||||
for (h = 0; h < (1 << nht->hash_shift); h++) {
|
||||
if (h < s_h)
|
||||
continue;
|
||||
for (h = s_h; h < (1 << nht->hash_shift); h++) {
|
||||
if (h > s_h)
|
||||
s_idx = 0;
|
||||
for (n = rcu_dereference_bh(nht->hash_buckets[h]), idx = 0;
|
||||
|
|
@ -2255,9 +2253,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
|||
|
||||
read_lock_bh(&tbl->lock);
|
||||
|
||||
for (h = 0; h <= PNEIGH_HASHMASK; h++) {
|
||||
if (h < s_h)
|
||||
continue;
|
||||
for (h = s_h; h <= PNEIGH_HASHMASK; h++) {
|
||||
if (h > s_h)
|
||||
s_idx = 0;
|
||||
for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
|
||||
|
|
@ -2292,7 +2288,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
struct neigh_table *tbl;
|
||||
int t, family, s_t;
|
||||
int proxy = 0;
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
read_lock(&neigh_tbl_lock);
|
||||
family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family;
|
||||
|
|
@ -2306,7 +2302,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
|
||||
s_t = cb->args[0];
|
||||
|
||||
for (tbl = neigh_tables, t = 0; tbl && (err >= 0);
|
||||
for (tbl = neigh_tables, t = 0; tbl;
|
||||
tbl = tbl->next, t++) {
|
||||
if (t < s_t || (family && tbl->family != family))
|
||||
continue;
|
||||
|
|
@ -2317,6 +2313,8 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
err = pneigh_dump_table(tbl, skb, cb);
|
||||
else
|
||||
err = neigh_dump_table(tbl, skb, cb);
|
||||
if (err < 0)
|
||||
break;
|
||||
}
|
||||
read_unlock(&neigh_tbl_lock);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user