drivers/edac: mod assert_error check
[safe/jmp/linux-2.6] / net / decnet / dn_route.c
index bb73bf1..82622fb 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/rcupdate.h>
 #include <linux/times.h>
 #include <asm/errno.h>
+#include <net/netlink.h>
 #include <net/neighbour.h>
 #include <net/dst.h>
 #include <net/flow.h>
@@ -885,7 +886,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
                            .iif = loopback_dev.ifindex,
                            .oif = oldflp->oif };
        struct dn_route *rt = NULL;
-       struct net_device *dev_out = NULL;
+       struct net_device *dev_out = NULL, *dev;
        struct neighbour *neigh = NULL;
        unsigned hash;
        unsigned flags = 0;
@@ -924,15 +925,17 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
                        goto out;
                }
                read_lock(&dev_base_lock);
-               for(dev_out = dev_base; dev_out; dev_out = dev_out->next) {
-                       if (!dev_out->dn_ptr)
+               for_each_netdev(dev) {
+                       if (!dev->dn_ptr)
                                continue;
-                       if (!dn_dev_islocal(dev_out, oldflp->fld_src))
+                       if (!dn_dev_islocal(dev, oldflp->fld_src))
                                continue;
-                       if ((dev_out->flags & IFF_LOOPBACK) &&
+                       if ((dev->flags & IFF_LOOPBACK) &&
                            oldflp->fld_dst &&
-                           !dn_dev_islocal(dev_out, oldflp->fld_dst))
+                           !dn_dev_islocal(dev, oldflp->fld_dst))
                                continue;
+
+                       dev_out = dev;
                        break;
                }
                read_unlock(&dev_base_lock);
@@ -1468,7 +1471,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        struct dn_route *rt = (struct dn_route *)skb->dst;
        struct rtmsg *r;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        long expires;
 
        nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
@@ -1509,19 +1512,19 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
        if (rt->fl.iif)
                RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
 
-       nlh->nlmsg_len = skb->tail - b;
+       nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 nlmsg_failure:
 rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }
 
 /*
  * This is called by both endnodes and routers now.
  */
-int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
+static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
 {
        struct rtattr **rta = arg;
        struct rtmsg *rtm = NLMSG_DATA(nlh);
@@ -1723,7 +1726,7 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct seq_operations dn_rt_cache_seq_ops = {
+static const struct seq_operations dn_rt_cache_seq_ops = {
        .start  = dn_rt_cache_seq_start,
        .next   = dn_rt_cache_seq_next,
        .stop   = dn_rt_cache_seq_stop,
@@ -1812,6 +1815,13 @@ void __init dn_route_init(void)
        dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
 
        proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
+
+#ifdef CONFIG_DECNET_ROUTER
+       rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump);
+#else
+       rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
+                     dn_cache_dump);
+#endif
 }
 
 void __exit dn_route_cleanup(void)