]> err.no Git - linux-2.6/blobdiff - net/ipx/af_ipx.c
the scheduled ieee80211 softmac removal
[linux-2.6] / net / ipx / af_ipx.c
index cac35a77f069da4594b1585b4f8fc50cd2f8f54c..c76a9523091b2747f6b9c01dee54d478bd3b4ec7 100644 (file)
@@ -87,16 +87,11 @@ extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
                            unsigned char *node);
 extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
 extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
-                              struct iovec *iov, int len, int noblock);
+                              struct iovec *iov, size_t len, int noblock);
 extern int ipxrtr_route_skb(struct sk_buff *skb);
 extern struct ipx_route *ipxrtr_lookup(__be32 net);
 extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
 
-#undef IPX_REFCNT_DEBUG
-#ifdef IPX_REFCNT_DEBUG
-atomic_t ipx_sock_nr;
-#endif
-
 struct ipx_interface *ipx_interfaces_head(void)
 {
        struct ipx_interface *rc = NULL;
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk)
 {
        ipx_remove_socket(sk);
        skb_queue_purge(&sk->sk_receive_queue);
-#ifdef IPX_REFCNT_DEBUG
-       atomic_dec(&ipx_sock_nr);
-       printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk,
-                       atomic_read(&ipx_sock_nr));
-       if (atomic_read(&sk->sk_refcnt) != 1)
-               printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n",
-                               sk, atomic_read(&sk->sk_refcnt));
-#endif
+       sk_refcnt_debug_dec(sk);
        sock_put(sk);
 }
 
@@ -347,6 +335,9 @@ static int ipxitf_device_event(struct notifier_block *notifier,
        struct net_device *dev = ptr;
        struct ipx_interface *i, *tmp;
 
+       if (dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        if (event != NETDEV_DOWN && event != NETDEV_UP)
                goto out;
 
@@ -576,7 +567,9 @@ static struct sk_buff *ipxitf_adjust_skbuff(struct ipx_interface *intrfc,
        skb2 = alloc_skb(len, GFP_ATOMIC);
        if (skb2) {
                skb_reserve(skb2, out_offset);
-               skb2->nh.raw = skb2->h.raw = skb_put(skb2, skb->len);
+               skb_reset_network_header(skb2);
+               skb_reset_transport_header(skb2);
+               skb_put(skb2, skb->len);
                memcpy(ipx_hdr(skb2), ipx_hdr(skb), skb->len);
                memcpy(skb2->cb, skb->cb, sizeof(skb->cb));
        }
@@ -984,7 +977,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
        if (intrfc)
                ipxitf_put(intrfc);
 
-       dev = dev_get_by_name(idef->ipx_device);
+       dev = dev_get_by_name(&init_net, idef->ipx_device);
        rc = -ENODEV;
        if (!dev)
                goto out;
@@ -1092,7 +1085,7 @@ static int ipxitf_delete(struct ipx_interface_definition *idef)
        if (!dlink_type)
                goto out;
 
-       dev = __dev_get_by_name(idef->ipx_device);
+       dev = __dev_get_by_name(&init_net, idef->ipx_device);
        rc = -ENODEV;
        if (!dev)
                goto out;
@@ -1187,7 +1180,7 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
                if (copy_from_user(&ifr, arg, sizeof(ifr)))
                        break;
                sipx = (struct sockaddr_ipx *)&ifr.ifr_addr;
-               dev  = __dev_get_by_name(ifr.ifr_name);
+               dev  = __dev_get_by_name(&init_net, ifr.ifr_name);
                rc   = -ENODEV;
                if (!dev)
                        break;
@@ -1358,11 +1351,14 @@ static struct proto ipx_proto = {
        .obj_size = sizeof(struct ipx_sock),
 };
 
-static int ipx_create(struct socket *sock, int protocol)
+static int ipx_create(struct net *net, struct socket *sock, int protocol)
 {
        int rc = -ESOCKTNOSUPPORT;
        struct sock *sk;
 
+       if (net != &init_net)
+               return -EAFNOSUPPORT;
+
        /*
         * SPX support is not anymore in the kernel sources. If you want to
         * ressurrect it, completing it and making it understand shared skbs,
@@ -1373,14 +1369,11 @@ static int ipx_create(struct socket *sock, int protocol)
                goto out;
 
        rc = -ENOMEM;
-       sk = sk_alloc(PF_IPX, GFP_KERNEL, &ipx_proto, 1);
+       sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
        if (!sk)
                goto out;
-#ifdef IPX_REFCNT_DEBUG
-       atomic_inc(&ipx_sock_nr);
-       printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk,
-                       atomic_read(&ipx_sock_nr));
-#endif
+
+       sk_refcnt_debug_inc(sk);
        sock_init_data(sock, sk);
        sk->sk_no_check = 1;            /* Checksum off by default */
        sock->ops = &ipx_dgram_ops;
@@ -1401,6 +1394,7 @@ static int ipx_release(struct socket *sock)
 
        sock_set_flag(sk, SOCK_DEAD);
        sock->sk = NULL;
+       sk_refcnt_debug_release(sk);
        ipx_destroy_socket(sk);
 out:
        return 0;
@@ -1642,6 +1636,9 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
        u16 ipx_pktsize;
        int rc = 0;
 
+       if (dev->nd_net != &init_net)
+               goto drop;
+
        /* Not ours */
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop;
@@ -1807,8 +1804,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
                                     copied);
        if (rc)
                goto out_free;
-       if (skb->tstamp.off_sec)
-               skb_get_timestamp(skb, &sk->sk_stamp);
+       if (skb->tstamp.tv64)
+               sk->sk_stamp = skb->tstamp;
 
        msg->msg_namelen = sizeof(*sipx);
 
@@ -1959,7 +1956,6 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
        .sendpage       = sock_no_sendpage,
 };
 
-#include <linux/smp_lock.h>
 SOCKOPS_WRAP(ipx_dgram, PF_IPX);
 
 static struct packet_type ipx_8023_packet_type = {