[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>
This commit is contained in:
@ -160,7 +160,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
|
||||
.dport = dport } } };
|
||||
|
||||
int err;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
if (!dst || !src) {
|
||||
err = __ip_route_output_key(net, rp, &fl);
|
||||
if (err)
|
||||
@ -188,7 +188,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
|
||||
ip_rt_put(*rp);
|
||||
*rp = NULL;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0);
|
||||
return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user