diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 13:26:21 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 15:39:55 -0400 |
commit | 3b1e0a655f8eba44ab1ee2a1068d169ccfb853b9 (patch) | |
tree | 09edb35f32ebcfb1b4dad904425128a110ef16ee /net/ipv4/raw.c | |
parent | c346dca10840a874240c78efe3f39acf4312a1f2 (diff) |
[NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS.
Introduce per-sock inlines: sock_net(), sock_net_set()
and per-inet_timewait_sock inlines: twsk_net(), twsk_net_set().
Without CONFIG_NET_NS, no namespace other than &init_net exists.
Let's explicitly define them to help compiler optimizations.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 8756d502a47f..be19a4048d7c 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, | |||
117 | sk_for_each_from(sk, node) { | 117 | sk_for_each_from(sk, node) { |
118 | struct inet_sock *inet = inet_sk(sk); | 118 | struct inet_sock *inet = inet_sk(sk); |
119 | 119 | ||
120 | if (sk->sk_net == net && inet->num == num && | 120 | if (sock_net(sk) == net && inet->num == num && |
121 | !(inet->daddr && inet->daddr != raddr) && | 121 | !(inet->daddr && inet->daddr != raddr) && |
122 | !(inet->rcv_saddr && inet->rcv_saddr != laddr) && | 122 | !(inet->rcv_saddr && inet->rcv_saddr != laddr) && |
123 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | 123 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) |
@@ -499,7 +499,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
499 | ipc.oif = sk->sk_bound_dev_if; | 499 | ipc.oif = sk->sk_bound_dev_if; |
500 | 500 | ||
501 | if (msg->msg_controllen) { | 501 | if (msg->msg_controllen) { |
502 | err = ip_cmsg_send(sk->sk_net, msg, &ipc); | 502 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); |
503 | if (err) | 503 | if (err) |
504 | goto out; | 504 | goto out; |
505 | if (ipc.opt) | 505 | if (ipc.opt) |
@@ -553,7 +553,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
553 | } | 553 | } |
554 | 554 | ||
555 | security_sk_classify_flow(sk, &fl); | 555 | security_sk_classify_flow(sk, &fl); |
556 | err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1); | 556 | err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1); |
557 | } | 557 | } |
558 | if (err) | 558 | if (err) |
559 | goto done; | 559 | goto done; |
@@ -620,7 +620,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
620 | 620 | ||
621 | if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) | 621 | if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) |
622 | goto out; | 622 | goto out; |
623 | chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr); | 623 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); |
624 | ret = -EADDRNOTAVAIL; | 624 | ret = -EADDRNOTAVAIL; |
625 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && | 625 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && |
626 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 626 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
@@ -856,7 +856,7 @@ static struct sock *raw_get_first(struct seq_file *seq) | |||
856 | struct hlist_node *node; | 856 | struct hlist_node *node; |
857 | 857 | ||
858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) | 858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) |
859 | if (sk->sk_net == state->p.net) | 859 | if (sock_net(sk) == state->p.net) |
860 | goto found; | 860 | goto found; |
861 | } | 861 | } |
862 | sk = NULL; | 862 | sk = NULL; |
@@ -872,7 +872,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | |||
872 | sk = sk_next(sk); | 872 | sk = sk_next(sk); |
873 | try_again: | 873 | try_again: |
874 | ; | 874 | ; |
875 | } while (sk && sk->sk_net != state->p.net); | 875 | } while (sk && sock_net(sk) != state->p.net); |
876 | 876 | ||
877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { | 877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { |
878 | sk = sk_head(&state->h->ht[state->bucket]); | 878 | sk = sk_head(&state->h->ht[state->bucket]); |