diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3c49e6b..6e1aaa4 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -357,6 +357,7 @@ int inet_dump_fib(struct sk_buff *skb, s unsigned int e = 0, s_e; struct fib_table *tb; struct hlist_node *node; + int dumped = 0; if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) && ((struct rtmsg*)NLMSG_DATA(cb->nlh))->rtm_flags&RTM_F_CLONED) @@ -365,16 +366,17 @@ int inet_dump_fib(struct sk_buff *skb, s s_h = cb->args[0]; s_e = cb->args[1]; - for (h = s_h; h < FIB_TABLE_HASHSZ; h++) { + for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) { e = 0; hlist_for_each_entry(tb, node, &fib_table_hash[h], tb_hlist) { if (e < s_e) goto next; - if (e > s_e) - memset(&cb->args[1], 0, sizeof(cb->args) - + if (dumped) + memset(&cb->args[2], 0, sizeof(cb->args) - 2 * sizeof(cb->args[0])); if (tb->tb_dump(tb, skb, cb) < 0) goto out; + dumped = 1; next: e++; } diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index a41ab4b..6f33f12 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -459,13 +459,13 @@ int inet_dump_rules(struct sk_buff *skb, rcu_read_lock(); hlist_for_each_entry(r, node, &fib_rules, hlist) { - if (idx < s_idx) - continue; + goto next; if (inet_fill_rule(skb, r, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_NEWRULE, NLM_F_MULTI) < 0) break; +next: idx++; } rcu_read_unlock();