aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 13:26:21 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-25 15:39:55 -0400
commit3b1e0a655f8eba44ab1ee2a1068d169ccfb853b9 (patch)
tree09edb35f32ebcfb1b4dad904425128a110ef16ee /net/ipv6
parentc346dca10840a874240c78efe3f39acf4312a1f2 (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/ipv6')
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/addrlabel.c6
-rw-r--r--net/ipv6/af_inet6.c4
-rw-r--r--net/ipv6/fib6_rules.c2
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/ipv6/inet6_hashtables.c4
-rw-r--r--net/ipv6/ip6_fib.c2
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/mcast.c12
-rw-r--r--net/ipv6/netfilter/ip6_tables.c16
-rw-r--r--net/ipv6/raw.c6
-rw-r--r--net/ipv6/route.c4
-rw-r--r--net/ipv6/tcp_ipv6.c2
-rw-r--r--net/ipv6/udp.c4
15 files changed, 39 insertions, 39 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d1de9ec74261..f2c90f145cbb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3054,7 +3054,7 @@ static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
3054static int 3054static int
3055inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 3055inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
3056{ 3056{
3057 struct net *net = skb->sk->sk_net; 3057 struct net *net = sock_net(skb->sk);
3058 struct ifaddrmsg *ifm; 3058 struct ifaddrmsg *ifm;
3059 struct nlattr *tb[IFA_MAX+1]; 3059 struct nlattr *tb[IFA_MAX+1];
3060 struct in6_addr *pfx; 3060 struct in6_addr *pfx;
@@ -3112,7 +3112,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
3112static int 3112static int
3113inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 3113inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
3114{ 3114{
3115 struct net *net = skb->sk->sk_net; 3115 struct net *net = sock_net(skb->sk);
3116 struct ifaddrmsg *ifm; 3116 struct ifaddrmsg *ifm;
3117 struct nlattr *tb[IFA_MAX+1]; 3117 struct nlattr *tb[IFA_MAX+1];
3118 struct in6_addr *pfx; 3118 struct in6_addr *pfx;
@@ -3322,7 +3322,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3322 struct inet6_ifaddr *ifa; 3322 struct inet6_ifaddr *ifa;
3323 struct ifmcaddr6 *ifmca; 3323 struct ifmcaddr6 *ifmca;
3324 struct ifacaddr6 *ifaca; 3324 struct ifacaddr6 *ifaca;
3325 struct net *net = skb->sk->sk_net; 3325 struct net *net = sock_net(skb->sk);
3326 3326
3327 s_idx = cb->args[0]; 3327 s_idx = cb->args[0];
3328 s_ip_idx = ip_idx = cb->args[1]; 3328 s_ip_idx = ip_idx = cb->args[1];
@@ -3418,7 +3418,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
3418static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh, 3418static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
3419 void *arg) 3419 void *arg)
3420{ 3420{
3421 struct net *net = in_skb->sk->sk_net; 3421 struct net *net = sock_net(in_skb->sk);
3422 struct ifaddrmsg *ifm; 3422 struct ifaddrmsg *ifm;
3423 struct nlattr *tb[IFA_MAX+1]; 3423 struct nlattr *tb[IFA_MAX+1];
3424 struct in6_addr *addr = NULL; 3424 struct in6_addr *addr = NULL;
@@ -3645,7 +3645,7 @@ nla_put_failure:
3645 3645
3646static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 3646static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3647{ 3647{
3648 struct net *net = skb->sk->sk_net; 3648 struct net *net = sock_net(skb->sk);
3649 int idx, err; 3649 int idx, err;
3650 int s_idx = cb->args[0]; 3650 int s_idx = cb->args[0];
3651 struct net_device *dev; 3651 struct net_device *dev;
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index de371b5997fe..9bfa8846f262 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -364,7 +364,7 @@ static const struct nla_policy ifal_policy[IFAL_MAX+1] = {
364static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh, 364static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh,
365 void *arg) 365 void *arg)
366{ 366{
367 struct net *net = skb->sk->sk_net; 367 struct net *net = sock_net(skb->sk);
368 struct ifaddrlblmsg *ifal; 368 struct ifaddrlblmsg *ifal;
369 struct nlattr *tb[IFAL_MAX+1]; 369 struct nlattr *tb[IFAL_MAX+1];
370 struct in6_addr *pfx; 370 struct in6_addr *pfx;
@@ -452,7 +452,7 @@ static int ip6addrlbl_fill(struct sk_buff *skb,
452 452
453static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) 453static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb)
454{ 454{
455 struct net *net = skb->sk->sk_net; 455 struct net *net = sock_net(skb->sk);
456 struct ip6addrlbl_entry *p; 456 struct ip6addrlbl_entry *p;
457 struct hlist_node *pos; 457 struct hlist_node *pos;
458 int idx = 0, s_idx = cb->args[0]; 458 int idx = 0, s_idx = cb->args[0];
@@ -490,7 +490,7 @@ static inline int ip6addrlbl_msgsize(void)
490static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh, 490static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh,
491 void *arg) 491 void *arg)
492{ 492{
493 struct net *net = in_skb->sk->sk_net; 493 struct net *net = sock_net(in_skb->sk);
494 struct ifaddrlblmsg *ifal; 494 struct ifaddrlblmsg *ifal;
495 struct nlattr *tb[IFAL_MAX+1]; 495 struct nlattr *tb[IFAL_MAX+1];
496 struct in6_addr *addr; 496 struct in6_addr *addr;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index f52bdaed8a1b..12f04e9d3e88 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -245,7 +245,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
245 struct sock *sk = sock->sk; 245 struct sock *sk = sock->sk;
246 struct inet_sock *inet = inet_sk(sk); 246 struct inet_sock *inet = inet_sk(sk);
247 struct ipv6_pinfo *np = inet6_sk(sk); 247 struct ipv6_pinfo *np = inet6_sk(sk);
248 struct net *net = sk->sk_net; 248 struct net *net = sock_net(sk);
249 __be32 v4addr = 0; 249 __be32 v4addr = 0;
250 unsigned short snum; 250 unsigned short snum;
251 int addr_type = 0; 251 int addr_type = 0;
@@ -438,7 +438,7 @@ EXPORT_SYMBOL(inet6_getname);
438int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 438int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
439{ 439{
440 struct sock *sk = sock->sk; 440 struct sock *sk = sock->sk;
441 struct net *net = sk->sk_net; 441 struct net *net = sock_net(sk);
442 442
443 switch(cmd) 443 switch(cmd)
444 { 444 {
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index e7a7fe26cebf..cac580749ebe 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -154,7 +154,7 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
154 struct nlattr **tb) 154 struct nlattr **tb)
155{ 155{
156 int err = -EINVAL; 156 int err = -EINVAL;
157 struct net *net = skb->sk->sk_net; 157 struct net *net = sock_net(skb->sk);
158 struct fib6_rule *rule6 = (struct fib6_rule *) rule; 158 struct fib6_rule *rule6 = (struct fib6_rule *) rule;
159 159
160 if (rule->action == FR_ACT_TO_TBL) { 160 if (rule->action == FR_ACT_TO_TBL) {
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 50857662e6b7..63309d10df3a 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -163,7 +163,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
163 struct flowi *fl) 163 struct flowi *fl)
164{ 164{
165 struct dst_entry *dst; 165 struct dst_entry *dst;
166 struct net *net = sk->sk_net; 166 struct net *net = sock_net(sk);
167 int res = 0; 167 int res = 0;
168 168
169 /* Informational messages are not limited. */ 169 /* Informational messages are not limited. */
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index c0c8d2d17682..21c467675412 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -105,7 +105,7 @@ struct sock *inet6_lookup_listener(struct net *net,
105 105
106 read_lock(&hashinfo->lhash_lock); 106 read_lock(&hashinfo->lhash_lock);
107 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { 107 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) {
108 if (sk->sk_net == net && inet_sk(sk)->num == hnum && 108 if (sock_net(sk) == net && inet_sk(sk)->num == hnum &&
109 sk->sk_family == PF_INET6) { 109 sk->sk_family == PF_INET6) {
110 const struct ipv6_pinfo *np = inet6_sk(sk); 110 const struct ipv6_pinfo *np = inet6_sk(sk);
111 111
@@ -172,7 +172,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
172 struct sock *sk2; 172 struct sock *sk2;
173 const struct hlist_node *node; 173 const struct hlist_node *node;
174 struct inet_timewait_sock *tw; 174 struct inet_timewait_sock *tw;
175 struct net *net = sk->sk_net; 175 struct net *net = sock_net(sk);
176 176
177 prefetch(head->chain.first); 177 prefetch(head->chain.first);
178 write_lock(lock); 178 write_lock(lock);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index b0814b0082e7..b3f6e03c454c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -346,7 +346,7 @@ end:
346 346
347static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) 347static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
348{ 348{
349 struct net *net = skb->sk->sk_net; 349 struct net *net = sock_net(skb->sk);
350 unsigned int h, s_h; 350 unsigned int h, s_h;
351 unsigned int e = 0, s_e; 351 unsigned int e = 0, s_e;
352 struct rt6_rtnl_dump_arg arg; 352 struct rt6_rtnl_dump_arg arg;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 556300f0eba5..a8b4da25b0a7 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -910,7 +910,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
910 struct dst_entry **dst, struct flowi *fl) 910 struct dst_entry **dst, struct flowi *fl)
911{ 911{
912 int err; 912 int err;
913 struct net *net = sk->sk_net; 913 struct net *net = sock_net(sk);
914 914
915 if (*dst == NULL) 915 if (*dst == NULL)
916 *dst = ip6_route_output(net, sk, fl); 916 *dst = ip6_route_output(net, sk, fl);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index dc6695cc5767..d3d93d752e10 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -107,7 +107,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
107 char __user *optval, int optlen) 107 char __user *optval, int optlen)
108{ 108{
109 struct ipv6_pinfo *np = inet6_sk(sk); 109 struct ipv6_pinfo *np = inet6_sk(sk);
110 struct net *net = sk->sk_net; 110 struct net *net = sock_net(sk);
111 int val, valbool; 111 int val, valbool;
112 int retv = -ENOPROTOOPT; 112 int retv = -ENOPROTOOPT;
113 113
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 0357de8e78c8..20a3d8e2f6c6 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -181,7 +181,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
181 struct net_device *dev = NULL; 181 struct net_device *dev = NULL;
182 struct ipv6_mc_socklist *mc_lst; 182 struct ipv6_mc_socklist *mc_lst;
183 struct ipv6_pinfo *np = inet6_sk(sk); 183 struct ipv6_pinfo *np = inet6_sk(sk);
184 struct net *net = sk->sk_net; 184 struct net *net = sock_net(sk);
185 int err; 185 int err;
186 186
187 if (!ipv6_addr_is_multicast(addr)) 187 if (!ipv6_addr_is_multicast(addr))
@@ -255,7 +255,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
255{ 255{
256 struct ipv6_pinfo *np = inet6_sk(sk); 256 struct ipv6_pinfo *np = inet6_sk(sk);
257 struct ipv6_mc_socklist *mc_lst, **lnk; 257 struct ipv6_mc_socklist *mc_lst, **lnk;
258 struct net *net = sk->sk_net; 258 struct net *net = sock_net(sk);
259 259
260 write_lock_bh(&ipv6_sk_mc_lock); 260 write_lock_bh(&ipv6_sk_mc_lock);
261 for (lnk = &np->ipv6_mc_list; (mc_lst = *lnk) !=NULL ; lnk = &mc_lst->next) { 261 for (lnk = &np->ipv6_mc_list; (mc_lst = *lnk) !=NULL ; lnk = &mc_lst->next) {
@@ -327,7 +327,7 @@ void ipv6_sock_mc_close(struct sock *sk)
327{ 327{
328 struct ipv6_pinfo *np = inet6_sk(sk); 328 struct ipv6_pinfo *np = inet6_sk(sk);
329 struct ipv6_mc_socklist *mc_lst; 329 struct ipv6_mc_socklist *mc_lst;
330 struct net *net = sk->sk_net; 330 struct net *net = sock_net(sk);
331 331
332 write_lock_bh(&ipv6_sk_mc_lock); 332 write_lock_bh(&ipv6_sk_mc_lock);
333 while ((mc_lst = np->ipv6_mc_list) != NULL) { 333 while ((mc_lst = np->ipv6_mc_list) != NULL) {
@@ -365,7 +365,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
365 struct inet6_dev *idev; 365 struct inet6_dev *idev;
366 struct ipv6_pinfo *inet6 = inet6_sk(sk); 366 struct ipv6_pinfo *inet6 = inet6_sk(sk);
367 struct ip6_sf_socklist *psl; 367 struct ip6_sf_socklist *psl;
368 struct net *net = sk->sk_net; 368 struct net *net = sock_net(sk);
369 int i, j, rv; 369 int i, j, rv;
370 int leavegroup = 0; 370 int leavegroup = 0;
371 int pmclocked = 0; 371 int pmclocked = 0;
@@ -505,7 +505,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
505 struct inet6_dev *idev; 505 struct inet6_dev *idev;
506 struct ipv6_pinfo *inet6 = inet6_sk(sk); 506 struct ipv6_pinfo *inet6 = inet6_sk(sk);
507 struct ip6_sf_socklist *newpsl, *psl; 507 struct ip6_sf_socklist *newpsl, *psl;
508 struct net *net = sk->sk_net; 508 struct net *net = sock_net(sk);
509 int leavegroup = 0; 509 int leavegroup = 0;
510 int i, err; 510 int i, err;
511 511
@@ -598,7 +598,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
598 struct net_device *dev; 598 struct net_device *dev;
599 struct ipv6_pinfo *inet6 = inet6_sk(sk); 599 struct ipv6_pinfo *inet6 = inet6_sk(sk);
600 struct ip6_sf_socklist *psl; 600 struct ip6_sf_socklist *psl;
601 struct net *net = sk->sk_net; 601 struct net *net = sock_net(sk);
602 602
603 group = &((struct sockaddr_in6 *)&gsf->gf_group)->sin6_addr; 603 group = &((struct sockaddr_in6 *)&gsf->gf_group)->sin6_addr;
604 604
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index af1ec7ba757c..70ef0d276cc0 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1879,11 +1879,11 @@ compat_do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user,
1879 1879
1880 switch (cmd) { 1880 switch (cmd) {
1881 case IP6T_SO_SET_REPLACE: 1881 case IP6T_SO_SET_REPLACE:
1882 ret = compat_do_replace(sk->sk_net, user, len); 1882 ret = compat_do_replace(sock_net(sk), user, len);
1883 break; 1883 break;
1884 1884
1885 case IP6T_SO_SET_ADD_COUNTERS: 1885 case IP6T_SO_SET_ADD_COUNTERS:
1886 ret = do_add_counters(sk->sk_net, user, len, 1); 1886 ret = do_add_counters(sock_net(sk), user, len, 1);
1887 break; 1887 break;
1888 1888
1889 default: 1889 default:
@@ -1990,10 +1990,10 @@ compat_do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1990 1990
1991 switch (cmd) { 1991 switch (cmd) {
1992 case IP6T_SO_GET_INFO: 1992 case IP6T_SO_GET_INFO:
1993 ret = get_info(sk->sk_net, user, len, 1); 1993 ret = get_info(sock_net(sk), user, len, 1);
1994 break; 1994 break;
1995 case IP6T_SO_GET_ENTRIES: 1995 case IP6T_SO_GET_ENTRIES:
1996 ret = compat_get_entries(sk->sk_net, user, len); 1996 ret = compat_get_entries(sock_net(sk), user, len);
1997 break; 1997 break;
1998 default: 1998 default:
1999 ret = do_ip6t_get_ctl(sk, cmd, user, len); 1999 ret = do_ip6t_get_ctl(sk, cmd, user, len);
@@ -2012,11 +2012,11 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2012 2012
2013 switch (cmd) { 2013 switch (cmd) {
2014 case IP6T_SO_SET_REPLACE: 2014 case IP6T_SO_SET_REPLACE:
2015 ret = do_replace(sk->sk_net, user, len); 2015 ret = do_replace(sock_net(sk), user, len);
2016 break; 2016 break;
2017 2017
2018 case IP6T_SO_SET_ADD_COUNTERS: 2018 case IP6T_SO_SET_ADD_COUNTERS:
2019 ret = do_add_counters(sk->sk_net, user, len, 0); 2019 ret = do_add_counters(sock_net(sk), user, len, 0);
2020 break; 2020 break;
2021 2021
2022 default: 2022 default:
@@ -2037,11 +2037,11 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2037 2037
2038 switch (cmd) { 2038 switch (cmd) {
2039 case IP6T_SO_GET_INFO: 2039 case IP6T_SO_GET_INFO:
2040 ret = get_info(sk->sk_net, user, len, 0); 2040 ret = get_info(sock_net(sk), user, len, 0);
2041 break; 2041 break;
2042 2042
2043 case IP6T_SO_GET_ENTRIES: 2043 case IP6T_SO_GET_ENTRIES:
2044 ret = get_entries(sk->sk_net, user, len); 2044 ret = get_entries(sock_net(sk), user, len);
2045 break; 2045 break;
2046 2046
2047 case IP6T_SO_GET_REVISION_MATCH: 2047 case IP6T_SO_GET_REVISION_MATCH:
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index efb0047f6880..12c7a1560977 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -76,7 +76,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
76 if (inet_sk(sk)->num == num) { 76 if (inet_sk(sk)->num == num) {
77 struct ipv6_pinfo *np = inet6_sk(sk); 77 struct ipv6_pinfo *np = inet6_sk(sk);
78 78
79 if (sk->sk_net != net) 79 if (sock_net(sk) != net)
80 continue; 80 continue;
81 81
82 if (!ipv6_addr_any(&np->daddr) && 82 if (!ipv6_addr_any(&np->daddr) &&
@@ -280,7 +280,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
280 if (!sk->sk_bound_dev_if) 280 if (!sk->sk_bound_dev_if)
281 goto out; 281 goto out;
282 282
283 dev = dev_get_by_index(sk->sk_net, sk->sk_bound_dev_if); 283 dev = dev_get_by_index(sock_net(sk), sk->sk_bound_dev_if);
284 if (!dev) { 284 if (!dev) {
285 err = -ENODEV; 285 err = -ENODEV;
286 goto out; 286 goto out;
@@ -293,7 +293,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
293 v4addr = LOOPBACK4_IPV6; 293 v4addr = LOOPBACK4_IPV6;
294 if (!(addr_type & IPV6_ADDR_MULTICAST)) { 294 if (!(addr_type & IPV6_ADDR_MULTICAST)) {
295 err = -EADDRNOTAVAIL; 295 err = -EADDRNOTAVAIL;
296 if (!ipv6_chk_addr(sk->sk_net, &addr->sin6_addr, 296 if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr,
297 dev, 0)) { 297 dev, 0)) {
298 if (dev) 298 if (dev)
299 dev_put(dev); 299 dev_put(dev);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 65053fba8c1a..ac4428371432 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2020,7 +2020,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
2020 2020
2021 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; 2021 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
2022 cfg->fc_nlinfo.nlh = nlh; 2022 cfg->fc_nlinfo.nlh = nlh;
2023 cfg->fc_nlinfo.nl_net = skb->sk->sk_net; 2023 cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
2024 2024
2025 if (tb[RTA_GATEWAY]) { 2025 if (tb[RTA_GATEWAY]) {
2026 nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16); 2026 nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16);
@@ -2216,7 +2216,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
2216 2216
2217static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) 2217static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2218{ 2218{
2219 struct net *net = in_skb->sk->sk_net; 2219 struct net *net = sock_net(in_skb->sk);
2220 struct nlattr *tb[RTA_MAX+1]; 2220 struct nlattr *tb[RTA_MAX+1];
2221 struct rt6_info *rt; 2221 struct rt6_info *rt;
2222 struct sk_buff *skb; 2222 struct sk_buff *skb;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 086deffff9c9..323c7e06ef43 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1218,7 +1218,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
1218 if (req) 1218 if (req)
1219 return tcp_check_req(sk, skb, req, prev); 1219 return tcp_check_req(sk, skb, req, prev);
1220 1220
1221 nsk = __inet6_lookup_established(sk->sk_net, &tcp_hashinfo, 1221 nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo,
1222 &ipv6_hdr(skb)->saddr, th->source, 1222 &ipv6_hdr(skb)->saddr, th->source,
1223 &ipv6_hdr(skb)->daddr, ntohs(th->dest), inet6_iif(skb)); 1223 &ipv6_hdr(skb)->daddr, ntohs(th->dest), inet6_iif(skb));
1224 1224
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 6683c04b427e..db266ff297e5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -70,7 +70,7 @@ static struct sock *__udp6_lib_lookup(struct net *net,
70 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { 70 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
71 struct inet_sock *inet = inet_sk(sk); 71 struct inet_sock *inet = inet_sk(sk);
72 72
73 if (sk->sk_net == net && sk->sk_hash == hnum && 73 if (sock_net(sk) == net && sk->sk_hash == hnum &&
74 sk->sk_family == PF_INET6) { 74 sk->sk_family == PF_INET6) {
75 struct ipv6_pinfo *np = inet6_sk(sk); 75 struct ipv6_pinfo *np = inet6_sk(sk);
76 int score = 0; 76 int score = 0;
@@ -323,7 +323,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
323 sk_for_each_from(s, node) { 323 sk_for_each_from(s, node) {
324 struct inet_sock *inet = inet_sk(s); 324 struct inet_sock *inet = inet_sk(s);
325 325
326 if (s->sk_net != sk->sk_net) 326 if (sock_net(s) != sock_net(sk))
327 continue; 327 continue;
328 328
329 if (s->sk_hash == num && s->sk_family == PF_INET6) { 329 if (s->sk_hash == num && s->sk_family == PF_INET6) {