ipv6: Avoid going through ->sk_net to access the netns
Subsystems (2)
PATCH 1/1 ipv6: Avoid going through ->sk_net to access the netns
There is no need to go through sk->sk_net to access the net namespace and its sysctl variables because we allocate the sock and initialize sk_net just a few lines earlier in the same routine.
Signed-off-by Jakub Sitnicki <[email protected]>
--- net/ipv6/af_inet6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/af_inet6.c +1 -1
@@ -210,7 +210,7 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, np->mcast_hops =IPV6_DEFAULT_MCASTHOPS ; np->mc_loop =1 ; np->pmtudisc =IPV6_PMTUDISC_WANT ; - np->autoflowlabel =ip6_default_np_autolabel (sock_net (sk)); + np->autoflowlabel =ip6_default_np_autolabel (net); sk->sk_ipv6only = net->ipv6.sysctl.bindv6only;/* Init the ipv4 part of the socket since we can have sockets
Signature · 1 line
2.9.4
From: Jakub Sitnicki <[email protected]>
Date: Mon, 31 Jul 2017 10:09:41 +0200
Quoted 5 lines
There is no need to go through
sk->sk_netto access the net namespace and its sysctl variables because we allocate the sock and initializesk_netjust a few lines earlier in the same routine.Signed-off-by Jakub Sitnicki <[email protected]>
Applied, thanks.