]> err.no Git - linux-2.6/blobdiff - net/ipv6/raw.c
[IPV6]: Simplify IPv6 control sockets creation.
[linux-2.6] / net / ipv6 / raw.c
index 548d0763f4d3ce5817e62982997f920944b0dae2..aae6cedf1709a68e1f1a760a7eb5a22cceff63c1 100644 (file)
@@ -76,7 +76,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
                if (inet_sk(sk)->num == num) {
                        struct ipv6_pinfo *np = inet6_sk(sk);
 
-                       if (sk->sk_net != net)
+                       if (!net_eq(sock_net(sk), net))
                                continue;
 
                        if (!ipv6_addr_any(&np->daddr) &&
@@ -168,15 +168,10 @@ static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
        read_lock(&raw_v6_hashinfo.lock);
        sk = sk_head(&raw_v6_hashinfo.ht[hash]);
 
-       /*
-        *      The first socket found will be delivered after
-        *      delivery to transport protocols.
-        */
-
        if (sk == NULL)
                goto out;
 
-       net = skb->dev->nd_net;
+       net = dev_net(skb->dev);
        sk = __raw_v6_lookup(net, sk, nexthdr, daddr, saddr, IP6CB(skb)->iif);
 
        while (sk) {
@@ -280,7 +275,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                        if (!sk->sk_bound_dev_if)
                                goto out;
 
-                       dev = dev_get_by_index(sk->sk_net, sk->sk_bound_dev_if);
+                       dev = dev_get_by_index(sock_net(sk), sk->sk_bound_dev_if);
                        if (!dev) {
                                err = -ENODEV;
                                goto out;
@@ -293,7 +288,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                v4addr = LOOPBACK4_IPV6;
                if (!(addr_type & IPV6_ADDR_MULTICAST)) {
                        err = -EADDRNOTAVAIL;
-                       if (!ipv6_chk_addr(sk->sk_net, &addr->sin6_addr,
+                       if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr,
                                           dev, 0)) {
                                if (dev)
                                        dev_put(dev);
@@ -363,7 +358,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
        if (sk != NULL) {
                saddr = &ipv6_hdr(skb)->saddr;
                daddr = &ipv6_hdr(skb)->daddr;
-               net = skb->dev->nd_net;
+               net = dev_net(skb->dev);
 
                while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr,
                                                IP6CB(skb)->iif))) {
@@ -1171,8 +1166,6 @@ static int rawv6_init_sk(struct sock *sk)
        return(0);
 }
 
-DEFINE_PROTO_INUSE(rawv6)
-
 struct proto rawv6_prot = {
        .name              = "RAWv6",
        .owner             = THIS_MODULE,
@@ -1196,7 +1189,6 @@ struct proto rawv6_prot = {
        .compat_setsockopt = compat_rawv6_setsockopt,
        .compat_getsockopt = compat_rawv6_getsockopt,
 #endif
-       REF_PROTO_INUSE(rawv6)
 };
 
 #ifdef CONFIG_PROC_FS