Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79512
b: refs/heads/master
c: d5ce8a0
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jan 28, 2008
1 parent fd4be8c commit 41481d4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9195bef7fb0ba0a91d5ffa566bcf8e007e3c7172
refs/heads/master: d5ce8a0e97073169b5fe0b7c52bd020cdb017dfa
34 changes: 21 additions & 13 deletions trunk/net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,35 +1917,43 @@ static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb,
return skb->len;
}



static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb,
struct netlink_callback *cb)
{
struct leaf *l;
struct trie *t = (struct trie *) tb->tb_data;
int h = 0;
int s_h = cb->args[2];
t_key key = cb->args[2];

rcu_read_lock();
for (h = 0, l = trie_firstleaf(t); l != NULL; h++, l = trie_nextleaf(l)) {
if (h < s_h)
continue;

if (h > s_h) {
cb->args[3] = 0;
cb->args[4] = 0;
/* Dump starting at last key.
* Note: 0.0.0.0/0 (ie default) is first key.
*/
if (!key)
l = trie_firstleaf(t);
else {
l = fib_find_node(t, key);
if (!l) {
/* The table changed during the dump, rather than
* giving partial data, just make application retry.
*/
rcu_read_unlock();
return -EBUSY;
}
}

while (l) {
cb->args[2] = l->key;
if (fn_trie_dump_leaf(l, tb, skb, cb) < 0) {
rcu_read_unlock();
cb->args[2] = h;
return -1;
}

l = trie_nextleaf(l);
memset(&cb->args[3], 0,
sizeof(cb->args) - 3*sizeof(cb->args[0]));
}
rcu_read_unlock();

cb->args[2] = h;
return skb->len;
}

Expand Down

0 comments on commit 41481d4

Please sign in to comment.