diff options
author | Eric Dumazet <edumazet@google.com> | 2012-06-07 00:58:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-07 16:02:21 -0400 |
commit | 4bd6683bd400c8b1d2ad544bb155d86a5d10f91c (patch) | |
tree | 027da56f4d117a30ce11340d86d6d2914ea1237f /net/core/neighbour.c | |
parent | a06998b88b1651c5f71c0e35f528bf2057188ead (diff) |
net: neighbour: fix neigh_dump_info()
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>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r-- | net/core/neighbour.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index eb09f8bbbf07..d81d026138f0 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2219,9 +2219,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, | |||
2219 | rcu_read_lock_bh(); | 2219 | rcu_read_lock_bh(); |
2220 | nht = rcu_dereference_bh(tbl->nht); | 2220 | nht = rcu_dereference_bh(tbl->nht); |
2221 | 2221 | ||
2222 | for (h = 0; h < (1 << nht->hash_shift); h++) { | 2222 | for (h = s_h; h < (1 << nht->hash_shift); h++) { |
2223 | if (h < s_h) | ||
2224 | continue; | ||
2225 | if (h > s_h) | 2223 | if (h > s_h) |
2226 | s_idx = 0; | 2224 | s_idx = 0; |
2227 | for (n = rcu_dereference_bh(nht->hash_buckets[h]), idx = 0; | 2225 | for (n = rcu_dereference_bh(nht->hash_buckets[h]), idx = 0; |
@@ -2260,9 +2258,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, | |||
2260 | 2258 | ||
2261 | read_lock_bh(&tbl->lock); | 2259 | read_lock_bh(&tbl->lock); |
2262 | 2260 | ||
2263 | for (h = 0; h <= PNEIGH_HASHMASK; h++) { | 2261 | for (h = s_h; h <= PNEIGH_HASHMASK; h++) { |
2264 | if (h < s_h) | ||
2265 | continue; | ||
2266 | if (h > s_h) | 2262 | if (h > s_h) |
2267 | s_idx = 0; | 2263 | s_idx = 0; |
2268 | for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) { | 2264 | for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) { |
@@ -2297,7 +2293,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) | |||
2297 | struct neigh_table *tbl; | 2293 | struct neigh_table *tbl; |
2298 | int t, family, s_t; | 2294 | int t, family, s_t; |
2299 | int proxy = 0; | 2295 | int proxy = 0; |
2300 | int err = 0; | 2296 | int err; |
2301 | 2297 | ||
2302 | read_lock(&neigh_tbl_lock); | 2298 | read_lock(&neigh_tbl_lock); |
2303 | family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family; | 2299 | family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family; |
@@ -2311,7 +2307,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) | |||
2311 | 2307 | ||
2312 | s_t = cb->args[0]; | 2308 | s_t = cb->args[0]; |
2313 | 2309 | ||
2314 | for (tbl = neigh_tables, t = 0; tbl && (err >= 0); | 2310 | for (tbl = neigh_tables, t = 0; tbl; |
2315 | tbl = tbl->next, t++) { | 2311 | tbl = tbl->next, t++) { |
2316 | if (t < s_t || (family && tbl->family != family)) | 2312 | if (t < s_t || (family && tbl->family != family)) |
2317 | continue; | 2313 | continue; |
@@ -2322,6 +2318,8 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) | |||
2322 | err = pneigh_dump_table(tbl, skb, cb); | 2318 | err = pneigh_dump_table(tbl, skb, cb); |
2323 | else | 2319 | else |
2324 | err = neigh_dump_table(tbl, skb, cb); | 2320 | err = neigh_dump_table(tbl, skb, cb); |
2321 | if (err < 0) | ||
2322 | break; | ||
2325 | } | 2323 | } |
2326 | read_unlock(&neigh_tbl_lock); | 2324 | read_unlock(&neigh_tbl_lock); |
2327 | 2325 | ||