fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / decnet / dn_dev.c
index efbead8..ed083ab 100644 (file)
@@ -24,7 +24,6 @@
  *                             devices. All mtu based now.
  */
 
-#include <linux/config.h>
 #include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/seq_file.h>
 #include <linux/timer.h>
 #include <linux/string.h>
+#include <linux/if_addr.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
 #include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
 #include <linux/sysctl.h>
 #include <linux/notifier.h>
 #include <asm/uaccess.h>
@@ -46,6 +45,8 @@
 #include <net/neighbour.h>
 #include <net/dst.h>
 #include <net/flow.h>
+#include <net/fib_rules.h>
+#include <net/netlink.h>
 #include <net/dn.h>
 #include <net/dn_dev.h>
 #include <net/dn_route.h>
@@ -64,15 +65,15 @@ extern struct neigh_table dn_neigh_table;
 /*
  * decnet_address is kept in network order.
  */
-dn_address decnet_address = 0;
+__le16 decnet_address = 0;
 
 static DEFINE_RWLOCK(dndev_lock);
 static struct net_device *decnet_default_device;
-static struct notifier_block *dnaddr_chain;
+static BLOCKING_NOTIFIER_HEAD(dnaddr_chain);
 
 static struct dn_dev *dn_dev_create(struct net_device *dev, int *err);
 static void dn_dev_delete(struct net_device *dev);
-static void rtmsg_ifa(int event, struct dn_ifaddr *ifa);
+static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa);
 
 static int dn_eth_up(struct net_device *);
 static void dn_eth_down(struct net_device *);
@@ -166,8 +167,7 @@ static int dn_forwarding_proc(ctl_table *, int, struct file *,
                        void __user *, size_t *, loff_t *);
 static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
                        void __user *oldval, size_t __user *oldlenp,
-                       void __user *newval, size_t newlen,
-                       void **context);
+                       void __user *newval, size_t newlen);
 
 static struct dn_dev_sysctl_table {
        struct ctl_table_header *sysctl_header;
@@ -254,12 +254,10 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
        struct dn_dev_sysctl_table *t;
        int i;
 
-       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL);
        if (t == NULL)
                return;
 
-       memcpy(t, &dn_dev_sysctl, sizeof(*t));
-
        for(i = 0; i < ARRAY_SIZE(t->dn_dev_vars) - 1; i++) {
                long offset = (long)t->dn_dev_vars[i].data;
                t->dn_dev_vars[i].data = ((char *)parms) + offset;
@@ -348,8 +346,7 @@ static int dn_forwarding_proc(ctl_table *table, int write,
 
 static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
                        void __user *oldval, size_t __user *oldlenp,
-                       void __user *newval, size_t newlen,
-                       void **context)
+                       void __user *newval, size_t newlen)
 {
 #ifdef CONFIG_DECNET_ROUTER
        struct net_device *dev = table->extra1;
@@ -414,11 +411,7 @@ static struct dn_ifaddr *dn_dev_alloc_ifa(void)
 {
        struct dn_ifaddr *ifa;
 
-       ifa = kmalloc(sizeof(*ifa), GFP_KERNEL);
-
-       if (ifa) {
-               memset(ifa, 0, sizeof(*ifa));
-       }
+       ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);
 
        return ifa;
 }
@@ -439,14 +432,14 @@ static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr **ifap, int de
        *ifap = ifa1->ifa_next;
 
        if (dn_db->dev->type == ARPHRD_ETHER) {
-               if (ifa1->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) {
+               if (ifa1->ifa_local != dn_eth2dn(dev->dev_addr)) {
                        dn_dn2eth(mac_addr, ifa1->ifa_local);
                        dev_mc_delete(dev, mac_addr, ETH_ALEN, 0);
                }
        }
 
-       rtmsg_ifa(RTM_DELADDR, ifa1);
-       notifier_call_chain(&dnaddr_chain, NETDEV_DOWN, ifa1);
+       dn_ifaddr_notify(RTM_DELADDR, ifa1);
+       blocking_notifier_call_chain(&dnaddr_chain, NETDEV_DOWN, ifa1);
        if (destroy) {
                dn_dev_free_ifa(ifa1);
 
@@ -470,7 +463,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
        }
 
        if (dev->type == ARPHRD_ETHER) {
-               if (ifa->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) {
+               if (ifa->ifa_local != dn_eth2dn(dev->dev_addr)) {
                        dn_dn2eth(mac_addr, ifa->ifa_local);
                        dev_mc_add(dev, mac_addr, ETH_ALEN, 0);
                        dev_mc_upload(dev);
@@ -480,8 +473,8 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
        ifa->ifa_next = dn_db->ifa_list;
        dn_db->ifa_list = ifa;
 
-       rtmsg_ifa(RTM_NEWADDR, ifa);
-       notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa);
+       dn_ifaddr_notify(RTM_NEWADDR, ifa);
+       blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa);
 
        return 0;
 }
@@ -561,7 +554,7 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
 
        switch(cmd) {
                case SIOCGIFADDR:
-                       *((dn_address *)sdn->sdn_nodeaddr) = ifa->ifa_local;
+                       *((__le16 *)sdn->sdn_nodeaddr) = ifa->ifa_local;
                        goto rarok;
 
                case SIOCSIFADDR:
@@ -620,7 +613,7 @@ int dn_dev_set_default(struct net_device *dev, int force)
        }
        write_unlock(&dndev_lock);
        if (old)
-               dev_put(dev);
+               dev_put(old);
        return rv;
 }
 
@@ -650,41 +643,62 @@ static struct dn_dev *dn_dev_by_index(int ifindex)
        return dn_dev;
 }
 
-static int dn_dev_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static struct nla_policy dn_ifa_policy[IFA_MAX+1] __read_mostly = {
+       [IFA_ADDRESS]           = { .type = NLA_U16 },
+       [IFA_LOCAL]             = { .type = NLA_U16 },
+       [IFA_LABEL]             = { .type = NLA_STRING,
+                                   .len = IFNAMSIZ - 1 },
+};
+
+static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 {
-       struct rtattr **rta = arg;
+       struct nlattr *tb[IFA_MAX+1];
        struct dn_dev *dn_db;
-       struct ifaddrmsg *ifm = NLMSG_DATA(nlh);
+       struct ifaddrmsg *ifm;
        struct dn_ifaddr *ifa, **ifap;
+       int err = -EADDRNOTAVAIL;
+
+       err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
+       if (err < 0)
+               goto errout;
 
+       ifm = nlmsg_data(nlh);
        if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL)
-               return -EADDRNOTAVAIL;
+               goto errout;
+
+       for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) {
+               if (tb[IFA_LOCAL] &&
+                   nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2))
+                       continue;
 
-       for(ifap = &dn_db->ifa_list; (ifa=*ifap) != NULL; ifap = &ifa->ifa_next) {
-               void *tmp = rta[IFA_LOCAL-1];
-               if ((tmp && memcmp(RTA_DATA(tmp), &ifa->ifa_local, 2)) ||
-                   (rta[IFA_LABEL-1] && rtattr_strcmp(rta[IFA_LABEL-1], ifa->ifa_label)))
+               if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label))
                        continue;
 
                dn_dev_del_ifa(dn_db, ifap, 1);
                return 0;
        }
 
-       return -EADDRNOTAVAIL;
+errout:
+       return err;
 }
 
-static int dn_dev_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 {
-       struct rtattr **rta = arg;
+       struct nlattr *tb[IFA_MAX+1];
        struct net_device *dev;
        struct dn_dev *dn_db;
-       struct ifaddrmsg *ifm = NLMSG_DATA(nlh);
+       struct ifaddrmsg *ifm;
        struct dn_ifaddr *ifa;
-       int rv;
+       int err;
+
+       err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
+       if (err < 0)
+               return err;
 
-       if (rta[IFA_LOCAL-1] == NULL)
+       if (tb[IFA_LOCAL] == NULL)
                return -EINVAL;
 
+       ifm = nlmsg_data(nlh);
        if ((dev = __dev_get_by_index(ifm->ifa_index)) == NULL)
                return -ENODEV;
 
@@ -698,113 +712,128 @@ static int dn_dev_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *a
        if ((ifa = dn_dev_alloc_ifa()) == NULL)
                return -ENOBUFS;
 
-       if (!rta[IFA_ADDRESS - 1])
-               rta[IFA_ADDRESS - 1] = rta[IFA_LOCAL - 1];
-       memcpy(&ifa->ifa_local, RTA_DATA(rta[IFA_LOCAL-1]), 2);
-       memcpy(&ifa->ifa_address, RTA_DATA(rta[IFA_ADDRESS-1]), 2);
+       if (tb[IFA_ADDRESS] == NULL)
+               tb[IFA_ADDRESS] = tb[IFA_LOCAL];
+
+       ifa->ifa_local = nla_get_le16(tb[IFA_LOCAL]);
+       ifa->ifa_address = nla_get_le16(tb[IFA_ADDRESS]);
        ifa->ifa_flags = ifm->ifa_flags;
        ifa->ifa_scope = ifm->ifa_scope;
        ifa->ifa_dev = dn_db;
-       if (rta[IFA_LABEL-1])
-               rtattr_strlcpy(ifa->ifa_label, rta[IFA_LABEL-1], IFNAMSIZ);
+
+       if (tb[IFA_LABEL])
+               nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
        else
                memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
 
-       rv = dn_dev_insert_ifa(dn_db, ifa);
-       if (rv)
+       err = dn_dev_insert_ifa(dn_db, ifa);
+       if (err)
                dn_dev_free_ifa(ifa);
-       return rv;
+
+       return err;
 }
 
-static int dn_dev_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa,
-                               u32 pid, u32 seq, int event, unsigned int flags)
+static inline size_t dn_ifaddr_nlmsg_size(void)
+{
+       return NLMSG_ALIGN(sizeof(struct ifaddrmsg))
+              + nla_total_size(IFNAMSIZ) /* IFA_LABEL */
+              + nla_total_size(2) /* IFA_ADDRESS */
+              + nla_total_size(2); /* IFA_LOCAL */
+}
+
+static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa,
+                            u32 pid, u32 seq, int event, unsigned int flags)
 {
        struct ifaddrmsg *ifm;
        struct nlmsghdr *nlh;
-       unsigned char *b = skb->tail;
 
-       nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags);
-       ifm = NLMSG_DATA(nlh);
+       nlh = nlmsg_put(skb, pid, seq, event, sizeof(*ifm), flags);
+       if (nlh == NULL)
+               return -ENOBUFS;
 
+       ifm = nlmsg_data(nlh);
        ifm->ifa_family = AF_DECnet;
        ifm->ifa_prefixlen = 16;
        ifm->ifa_flags = ifa->ifa_flags | IFA_F_PERMANENT;
        ifm->ifa_scope = ifa->ifa_scope;
        ifm->ifa_index = ifa->ifa_dev->dev->ifindex;
+
        if (ifa->ifa_address)
-               RTA_PUT(skb, IFA_ADDRESS, 2, &ifa->ifa_address);
+               NLA_PUT_LE16(skb, IFA_ADDRESS, ifa->ifa_address);
        if (ifa->ifa_local)
-               RTA_PUT(skb, IFA_LOCAL, 2, &ifa->ifa_local);
+               NLA_PUT_LE16(skb, IFA_LOCAL, ifa->ifa_local);
        if (ifa->ifa_label[0])
-               RTA_PUT(skb, IFA_LABEL, IFNAMSIZ, &ifa->ifa_label);
-       nlh->nlmsg_len = skb->tail - b;
-       return skb->len;
+               NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label);
+
+       return nlmsg_end(skb, nlh);
 
-nlmsg_failure:
-rtattr_failure:
-        skb_trim(skb, b - skb->data);
-        return -1;
+nla_put_failure:
+       return nlmsg_cancel(skb, nlh);
 }
 
-static void rtmsg_ifa(int event, struct dn_ifaddr *ifa)
+static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)
 {
        struct sk_buff *skb;
-       int size = NLMSG_SPACE(sizeof(struct ifaddrmsg)+128);
+       int err = -ENOBUFS;
 
-       skb = alloc_skb(size, GFP_KERNEL);
-       if (!skb) {
-               netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, ENOBUFS);
-               return;
-       }
-       if (dn_dev_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
-               kfree_skb(skb);
-               netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, EINVAL);
-               return;
-       }
-       NETLINK_CB(skb).dst_group = RTNLGRP_DECnet_IFADDR;
-       netlink_broadcast(rtnl, skb, 0, RTNLGRP_DECnet_IFADDR, GFP_KERNEL);
+       skb = alloc_skb(dn_ifaddr_nlmsg_size(), GFP_KERNEL);
+       if (skb == NULL)
+               goto errout;
+
+       err = dn_nl_fill_ifaddr(skb, ifa, 0, 0, event, 0);
+       /* failure implies BUG in dn_ifaddr_nlmsg_size() */
+       BUG_ON(err < 0);
+
+       err = rtnl_notify(skb, 0, RTNLGRP_DECnet_IFADDR, NULL, GFP_KERNEL);
+errout:
+       if (err < 0)
+               rtnl_set_sk_err(RTNLGRP_DECnet_IFADDR, err);
 }
 
-static int dn_dev_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
+static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
 {
-       int idx, dn_idx;
-       int s_idx, s_dn_idx;
+       int idx, dn_idx = 0, skip_ndevs, skip_naddr;
        struct net_device *dev;
        struct dn_dev *dn_db;
        struct dn_ifaddr *ifa;
 
-       s_idx = cb->args[0];
-       s_dn_idx = dn_idx = cb->args[1];
+       skip_ndevs = cb->args[0];
+       skip_naddr = cb->args[1];
+
        read_lock(&dev_base_lock);
-       for(dev = dev_base, idx = 0; dev; dev = dev->next, idx++) {
-               if (idx < s_idx)
+       for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) {
+               if (idx < skip_ndevs)
                        continue;
-               if (idx > s_idx)
-                       s_dn_idx = 0;
+               else if (idx > skip_ndevs) {
+                       /* Only skip over addresses for first dev dumped
+                        * in this iteration (idx == skip_ndevs) */
+                       skip_naddr = 0;
+               }
+
                if ((dn_db = dev->dn_ptr) == NULL)
                        continue;
 
-               for(ifa = dn_db->ifa_list, dn_idx = 0; ifa; ifa = ifa->ifa_next, dn_idx++) {
-                       if (dn_idx < s_dn_idx)
+               for (ifa = dn_db->ifa_list, dn_idx = 0; ifa;
+                    ifa = ifa->ifa_next, dn_idx++) {
+                       if (dn_idx < skip_naddr)
                                continue;
 
-                       if (dn_dev_fill_ifaddr(skb, ifa,
-                                              NETLINK_CB(cb->skb).pid,
-                                              cb->nlh->nlmsg_seq,
-                                              RTM_NEWADDR,
-                                              NLM_F_MULTI) <= 0)
+                       if (dn_nl_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
+                                             cb->nlh->nlmsg_seq, RTM_NEWADDR,
+                                             NLM_F_MULTI) < 0)
                                goto done;
                }
        }
 done:
        read_unlock(&dev_base_lock);
+
        cb->args[0] = idx;
        cb->args[1] = dn_idx;
 
        return skb->len;
 }
 
-static int dn_dev_get_first(struct net_device *dev, dn_address *addr)
+static int dn_dev_get_first(struct net_device *dev, __le16 *addr)
 {
        struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
        struct dn_ifaddr *ifa;
@@ -830,7 +859,7 @@ out:
  * a sensible default. Eventually the routing code will take care of all the
  * nasties for us I hope.
  */
-int dn_dev_bind_default(dn_address *addr)
+int dn_dev_bind_default(__le16 *addr)
 {
        struct net_device *dev;
        int rv;
@@ -853,7 +882,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
 {
         struct endnode_hello_message *msg;
         struct sk_buff *skb = NULL;
-        unsigned short int *pktlen;
+        __le16 *pktlen;
        struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
 
         if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL)
@@ -882,7 +911,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
         msg->datalen = 0x02;
         memset(msg->data, 0xAA, 2);
         
-        pktlen = (unsigned short *)skb_push(skb,2);
+        pktlen = (__le16 *)skb_push(skb,2);
         *pktlen = dn_htons(skb->len - 2);
 
        skb->nh.raw = skb->data;
@@ -926,7 +955,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
        size_t size;
        unsigned char *ptr;
        unsigned char *i1, *i2;
-       unsigned short *pktlen;
+       __le16 *pktlen;
        char *src;
 
        if (mtu2blksize(dev) < (26 + 7))
@@ -955,11 +984,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
        ptr += ETH_ALEN;
        *ptr++ = dn_db->parms.forwarding == 1 ? 
                        DN_RT_INFO_L1RT : DN_RT_INFO_L2RT;
-       *((unsigned short *)ptr) = dn_htons(mtu2blksize(dev));
+       *((__le16 *)ptr) = dn_htons(mtu2blksize(dev));
        ptr += 2;
        *ptr++ = dn_db->parms.priority; /* Priority */ 
        *ptr++ = 0; /* Area: Reserved */
-       *((unsigned short *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
+       *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
        ptr += 2;
        *ptr++ = 0; /* MPD: Reserved */
        i1 = ptr++;
@@ -974,7 +1003,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
 
        skb_trim(skb, (27 + *i2));
 
-       pktlen = (unsigned short *)skb_push(skb, 2);
+       pktlen = (__le16 *)skb_push(skb, 2);
        *pktlen = dn_htons(skb->len - 2);
 
        skb->nh.raw = skb->data;
@@ -1016,7 +1045,7 @@ static void dn_send_ptp_hello(struct net_device *dev, struct dn_ifaddr *ifa)
        ptr = skb_put(skb, 2 + 4 + tdlen);
 
        *ptr++ = DN_RT_PKT_HELO;
-       *((dn_address *)ptr) = ifa->ifa_local;
+       *((__le16 *)ptr) = ifa->ifa_local;
        ptr += 2;
        *ptr++ = tdlen;
 
@@ -1106,10 +1135,9 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
                return NULL;
 
        *err = -ENOBUFS;
-       if ((dn_db = kmalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL)
+       if ((dn_db = kzalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL)
                return NULL;
 
-       memset(dn_db, 0, sizeof(struct dn_dev));
        memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms));
        smp_wmb();
        dev->dn_ptr = dn_db;
@@ -1117,16 +1145,23 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
        init_timer(&dn_db->timer);
 
        dn_db->uptime = jiffies;
+
+       dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);
+       if (!dn_db->neigh_parms) {
+               dev->dn_ptr = NULL;
+               kfree(dn_db);
+               return NULL;
+       }
+
        if (dn_db->parms.up) {
                if (dn_db->parms.up(dev) < 0) {
+                       neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms);
                        dev->dn_ptr = NULL;
                        kfree(dn_db);
                        return NULL;
                }
        }
 
-       dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);
-
        dn_dev_sysctl_register(dev, &dn_db->parms);
 
        dn_dev_set_timer(dev);
@@ -1150,7 +1185,7 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
 void dn_dev_up(struct net_device *dev)
 {
        struct dn_ifaddr *ifa;
-       dn_address addr = decnet_address;
+       __le16 addr = decnet_address;
        int maybe_default = 0;
        struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
 
@@ -1173,7 +1208,7 @@ void dn_dev_up(struct net_device *dev)
        if (dev->type == ARPHRD_ETHER) {
                if (memcmp(dev->dev_addr, dn_hiord, 4) != 0)
                        return;
-               addr = dn_htons(dn_eth2dn(dev->dev_addr));
+               addr = dn_eth2dn(dev->dev_addr);
                maybe_default = 1;
        }
 
@@ -1285,12 +1320,12 @@ void dn_dev_devices_on(void)
 
 int register_dnaddr_notifier(struct notifier_block *nb)
 {
-       return notifier_chain_register(&dnaddr_chain, nb);
+       return blocking_notifier_chain_register(&dnaddr_chain, nb);
 }
 
 int unregister_dnaddr_notifier(struct notifier_block *nb)
 {
-       return notifier_chain_unregister(&dnaddr_chain, nb);
+       return blocking_notifier_chain_unregister(&dnaddr_chain, nb);
 }
 
 #ifdef CONFIG_PROC_FS
@@ -1385,8 +1420,8 @@ static int dn_dev_seq_show(struct seq_file *seq, void *v)
                                mtu2blksize(dev),
                                dn_db->parms.priority,
                                dn_db->parms.state, dn_db->parms.name,
-                               dn_db->router ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->router->primary_key), router_buf) : "",
-                               dn_db->peer ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->peer->primary_key), peer_buf) : "");
+                               dn_db->router ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->router->primary_key), router_buf) : "",
+                               dn_db->peer ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->peer->primary_key), peer_buf) : "");
        }
        return 0;
 }
@@ -1415,16 +1450,14 @@ static struct file_operations dn_dev_seq_fops = {
 
 static struct rtnetlink_link dnet_rtnetlink_table[RTM_NR_MSGTYPES] =
 {
-       [RTM_NEWADDR  - RTM_BASE] = { .doit     = dn_dev_rtm_newaddr,   },
-       [RTM_DELADDR  - RTM_BASE] = { .doit     = dn_dev_rtm_deladdr,   },
-       [RTM_GETADDR  - RTM_BASE] = { .dumpit   = dn_dev_dump_ifaddr,   },
+       [RTM_NEWADDR  - RTM_BASE] = { .doit     = dn_nl_newaddr,        },
+       [RTM_DELADDR  - RTM_BASE] = { .doit     = dn_nl_deladdr,        },
+       [RTM_GETADDR  - RTM_BASE] = { .dumpit   = dn_nl_dump_ifaddr,    },
 #ifdef CONFIG_DECNET_ROUTER
        [RTM_NEWROUTE - RTM_BASE] = { .doit     = dn_fib_rtm_newroute,  },
        [RTM_DELROUTE - RTM_BASE] = { .doit     = dn_fib_rtm_delroute,  },
        [RTM_GETROUTE - RTM_BASE] = { .doit     = dn_cache_getroute,
                                      .dumpit   = dn_fib_dump,          },
-       [RTM_NEWRULE  - RTM_BASE] = { .doit     = dn_fib_rtm_newrule,   },
-       [RTM_DELRULE  - RTM_BASE] = { .doit     = dn_fib_rtm_delrule,   },
        [RTM_GETRULE  - RTM_BASE] = { .dumpit   = dn_fib_dump_rules,    },
 #else
        [RTM_GETROUTE - RTM_BASE] = { .doit     = dn_cache_getroute,