[NETNS][RAW]: Eliminate explicit init_net references.
authorPavel Emelyanov <xemul@openvz.org>
Mon, 14 Jan 2008 13:36:27 +0000 (05:36 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:06 +0000 (15:02 -0800)
Happily, in all the rest places (->bind callbacks only), that require the
struct net, we have a socket, so get the net from it.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/raw.c
net/ipv6/raw.c

index 4e95372a78e7683a597d43eddc0973cff8a58a15..206c869db9214155c772a721562633da210f5ed8 100644 (file)
@@ -625,7 +625,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
        if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
                goto out;
-       chk_addr_ret = inet_addr_type(&init_net, addr->sin_addr.s_addr);
+       chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr);
        ret = -EADDRNOTAVAIL;
        if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
            chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
index 026fa910cb7032f70c70037c98d5cebc67d11d1f..970529e4754a27f1b19eeb10591c50d9ed64fc9a 100644 (file)
@@ -291,7 +291,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(&init_net, sk->sk_bound_dev_if);
+                       dev = dev_get_by_index(sk->sk_net, sk->sk_bound_dev_if);
                        if (!dev) {
                                err = -ENODEV;
                                goto out;
@@ -304,7 +304,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(&init_net, &addr->sin6_addr,
+                       if (!ipv6_chk_addr(sk->sk_net, &addr->sin6_addr,
                                           dev, 0)) {
                                if (dev)
                                        dev_put(dev);