]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/route.c
pkt_sched: Add multiqueue scheduler support
[linux-2.6-omap-h63xx.git] / net / ipv4 / route.c
index cca921ea855004f726906a9ed9f24249c7c0592b..f62187bb6d087caa3b0680e2122cd39988a77fb6 100644 (file)
@@ -282,6 +282,8 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
        struct rtable *r = NULL;
 
        for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
+               if (!rt_hash_table[st->bucket].chain)
+                       continue;
                rcu_read_lock_bh();
                r = rcu_dereference(rt_hash_table[st->bucket].chain);
                while (r) {
@@ -299,11 +301,14 @@ static struct rtable *__rt_cache_get_next(struct seq_file *seq,
                                          struct rtable *r)
 {
        struct rt_cache_iter_state *st = seq->private;
+
        r = r->u.dst.rt_next;
        while (!r) {
                rcu_read_unlock_bh();
-               if (--st->bucket < 0)
-                       break;
+               do {
+                       if (--st->bucket < 0)
+                               return NULL;
+               } while (!rt_hash_table[st->bucket].chain);
                rcu_read_lock_bh();
                r = rt_hash_table[st->bucket].chain;
        }
@@ -2840,7 +2845,9 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
        if (s_h < 0)
                s_h = 0;
        s_idx = idx = cb->args[1];
-       for (h = s_h; h <= rt_hash_mask; h++) {
+       for (h = s_h; h <= rt_hash_mask; h++, s_idx = 0) {
+               if (!rt_hash_table[h].chain)
+                       continue;
                rcu_read_lock_bh();
                for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
                     rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
@@ -2859,7 +2866,6 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
                        dst_release(xchg(&skb->dst, NULL));
                }
                rcu_read_unlock_bh();
-               s_idx = 0;
        }
 
 done:
@@ -3116,14 +3122,23 @@ static ctl_table ipv4_route_table[] = {
        { .ctl_name = 0 }
 };
 
-static __net_initdata struct ctl_path ipv4_route_path[] = {
+static struct ctl_table empty[1];
+
+static struct ctl_table ipv4_skeleton[] =
+{
+       { .procname = "route", .ctl_name = NET_IPV4_ROUTE,
+         .mode = 0555, .child = ipv4_route_table},
+       { .procname = "neigh", .ctl_name = NET_IPV4_NEIGH,
+         .mode = 0555, .child = empty},
+       { }
+};
+
+static __net_initdata struct ctl_path ipv4_path[] = {
        { .procname = "net", .ctl_name = CTL_NET, },
        { .procname = "ipv4", .ctl_name = NET_IPV4, },
-       { .procname = "route", .ctl_name = NET_IPV4_ROUTE, },
        { },
 };
 
-
 static struct ctl_table ipv4_route_flush_table[] = {
        {
                .ctl_name       = NET_IPV4_ROUTE_FLUSH,
@@ -3136,6 +3151,13 @@ static struct ctl_table ipv4_route_flush_table[] = {
        { .ctl_name = 0 },
 };
 
+static __net_initdata struct ctl_path ipv4_route_path[] = {
+       { .procname = "net", .ctl_name = CTL_NET, },
+       { .procname = "ipv4", .ctl_name = NET_IPV4, },
+       { .procname = "route", .ctl_name = NET_IPV4_ROUTE, },
+       { },
+};
+
 static __net_init int sysctl_route_net_init(struct net *net)
 {
        struct ctl_table *tbl;
@@ -3287,7 +3309,7 @@ int __init ip_rt_init(void)
  */
 void __init ip_static_sysctl_init(void)
 {
-       register_sysctl_paths(ipv4_route_path, ipv4_route_table);
+       register_sysctl_paths(ipv4_path, ipv4_skeleton);
 }
 #endif