pkt_sched: pedit use proper struct
[safe/jmp/linux-2.6] / net / ipv6 / ip6_fib.c
index 52dddc2..0e93ca5 100644 (file)
@@ -164,12 +164,6 @@ static __inline__ void rt6_release(struct rt6_info *rt)
                dst_free(&rt->u.dst);
 }
 
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-#define FIB_TABLE_HASHSZ 256
-#else
-#define FIB_TABLE_HASHSZ 1
-#endif
-
 static void fib6_link_table(struct net *net, struct fib6_table *tb)
 {
        unsigned int h;
@@ -180,7 +174,7 @@ static void fib6_link_table(struct net *net, struct fib6_table *tb)
         */
        rwlock_init(&tb->tb6_lock);
 
-       h = tb->tb6_id & (FIB_TABLE_HASHSZ - 1);
+       h = tb->tb6_id & (FIB6_TABLE_HASHSZ - 1);
 
        /*
         * No protection necessary, this is the only list mutatation
@@ -231,7 +225,7 @@ struct fib6_table *fib6_get_table(struct net *net, u32 id)
 
        if (id == 0)
                id = RT6_TABLE_MAIN;
-       h = id & (FIB_TABLE_HASHSZ - 1);
+       h = id & (FIB6_TABLE_HASHSZ - 1);
        rcu_read_lock();
        head = &net->ipv6.fib_table_hash[h];
        hlist_for_each_entry_rcu(tb, node, head, tb6_hlist) {
@@ -298,6 +292,10 @@ static void fib6_dump_end(struct netlink_callback *cb)
        struct fib6_walker_t *w = (void*)cb->args[2];
 
        if (w) {
+               if (cb->args[4]) {
+                       cb->args[4] = 0;
+                       fib6_walker_unlink(w);
+               }
                cb->args[2] = 0;
                kfree(w);
        }
@@ -330,15 +328,12 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
                read_lock_bh(&table->tb6_lock);
                res = fib6_walk_continue(w);
                read_unlock_bh(&table->tb6_lock);
-               if (res != 0) {
-                       if (res < 0)
-                               fib6_walker_unlink(w);
-                       goto end;
+               if (res <= 0) {
+                       fib6_walker_unlink(w);
+                       cb->args[4] = 0;
                }
-               fib6_walker_unlink(w);
-               cb->args[4] = 0;
        }
-end:
+
        return res;
 }
 
@@ -378,9 +373,10 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
 
        arg.skb = skb;
        arg.cb = cb;
+       arg.net = net;
        w->args = &arg;
 
-       for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) {
+       for (h = s_h; h < FIB6_TABLE_HASHSZ; h++, s_e = 0) {
                e = 0;
                head = &net->ipv6.fib_table_hash[h];
                hlist_for_each_entry(tb, node, head, tb6_hlist) {
@@ -1366,7 +1362,7 @@ void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
        unsigned int h;
 
        rcu_read_lock();
-       for (h = 0; h < FIB_TABLE_HASHSZ; h++) {
+       for (h = 0; h < FIB6_TABLE_HASHSZ; h++) {
                head = &net->ipv6.fib_table_hash[h];
                hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
                        write_lock_bh(&table->tb6_lock);
@@ -1481,7 +1477,7 @@ static int fib6_net_init(struct net *net)
        if (!net->ipv6.rt6_stats)
                goto out_timer;
 
-       net->ipv6.fib_table_hash = kcalloc(FIB_TABLE_HASHSZ,
+       net->ipv6.fib_table_hash = kcalloc(FIB6_TABLE_HASHSZ,
                                           sizeof(*net->ipv6.fib_table_hash),
                                           GFP_KERNEL);
        if (!net->ipv6.fib_table_hash)