aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_hashtables.c4
-rw-r--r--net/ipv4/raw.c2
-rw-r--r--net/ipv4/route.c10
-rw-r--r--net/ipv4/tcp_ipv4.c12
-rw-r--r--net/ipv4/udp.c10
5 files changed, 19 insertions, 19 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 1064111e5b96..1b6ff513c75d 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -139,7 +139,7 @@ static struct sock *inet_lookup_listener_slow(struct net *net,
139 sk_for_each(sk, node, head) { 139 sk_for_each(sk, node, head) {
140 const struct inet_sock *inet = inet_sk(sk); 140 const struct inet_sock *inet = inet_sk(sk);
141 141
142 if (sock_net(sk) == net && inet->num == hnum && 142 if (net_eq(sock_net(sk), net) && inet->num == hnum &&
143 !ipv6_only_sock(sk)) { 143 !ipv6_only_sock(sk)) {
144 const __be32 rcv_saddr = inet->rcv_saddr; 144 const __be32 rcv_saddr = inet->rcv_saddr;
145 int score = sk->sk_family == PF_INET ? 1 : 0; 145 int score = sk->sk_family == PF_INET ? 1 : 0;
@@ -182,7 +182,7 @@ struct sock *__inet_lookup_listener(struct net *net,
182 if (inet->num == hnum && !sk->sk_node.next && 182 if (inet->num == hnum && !sk->sk_node.next &&
183 (!inet->rcv_saddr || inet->rcv_saddr == daddr) && 183 (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
184 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && 184 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
185 !sk->sk_bound_dev_if && sock_net(sk) == net) 185 !sk->sk_bound_dev_if && net_eq(sock_net(sk), net))
186 goto sherry_cache; 186 goto sherry_cache;
187 sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif); 187 sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif);
188 } 188 }
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 25dc8b38cac3..d965f0a39c84 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 (sock_net(sk) == net && inet->num == num && 120 if (net_eq(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))
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index eab8d75e5222..230716c2dfe0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1196,7 +1196,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1196 rth->fl.oif != ikeys[k] || 1196 rth->fl.oif != ikeys[k] ||
1197 rth->fl.iif != 0 || 1197 rth->fl.iif != 0 ||
1198 rth->rt_genid != atomic_read(&rt_genid) || 1198 rth->rt_genid != atomic_read(&rt_genid) ||
1199 dev_net(rth->u.dst.dev) != net) { 1199 !net_eq(dev_net(rth->u.dst.dev), net)) {
1200 rthp = &rth->u.dst.rt_next; 1200 rthp = &rth->u.dst.rt_next;
1201 continue; 1201 continue;
1202 } 1202 }
@@ -1455,7 +1455,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
1455 rth->rt_src == iph->saddr && 1455 rth->rt_src == iph->saddr &&
1456 rth->fl.iif == 0 && 1456 rth->fl.iif == 0 &&
1457 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && 1457 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) &&
1458 dev_net(rth->u.dst.dev) == net && 1458 net_eq(dev_net(rth->u.dst.dev), net) &&
1459 rth->rt_genid == atomic_read(&rt_genid)) { 1459 rth->rt_genid == atomic_read(&rt_genid)) {
1460 unsigned short mtu = new_mtu; 1460 unsigned short mtu = new_mtu;
1461 1461
@@ -2085,7 +2085,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2085 rth->fl.oif == 0 && 2085 rth->fl.oif == 0 &&
2086 rth->fl.mark == skb->mark && 2086 rth->fl.mark == skb->mark &&
2087 rth->fl.fl4_tos == tos && 2087 rth->fl.fl4_tos == tos &&
2088 dev_net(rth->u.dst.dev) == net && 2088 net_eq(dev_net(rth->u.dst.dev), net) &&
2089 rth->rt_genid == atomic_read(&rt_genid)) { 2089 rth->rt_genid == atomic_read(&rt_genid)) {
2090 dst_use(&rth->u.dst, jiffies); 2090 dst_use(&rth->u.dst, jiffies);
2091 RT_CACHE_STAT_INC(in_hit); 2091 RT_CACHE_STAT_INC(in_hit);
@@ -2487,7 +2487,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
2487 rth->fl.mark == flp->mark && 2487 rth->fl.mark == flp->mark &&
2488 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2488 !((rth->fl.fl4_tos ^ flp->fl4_tos) &
2489 (IPTOS_RT_MASK | RTO_ONLINK)) && 2489 (IPTOS_RT_MASK | RTO_ONLINK)) &&
2490 dev_net(rth->u.dst.dev) == net && 2490 net_eq(dev_net(rth->u.dst.dev), net) &&
2491 rth->rt_genid == atomic_read(&rt_genid)) { 2491 rth->rt_genid == atomic_read(&rt_genid)) {
2492 dst_use(&rth->u.dst, jiffies); 2492 dst_use(&rth->u.dst, jiffies);
2493 RT_CACHE_STAT_INC(out_hit); 2493 RT_CACHE_STAT_INC(out_hit);
@@ -2796,7 +2796,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2796 rcu_read_lock_bh(); 2796 rcu_read_lock_bh();
2797 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; 2797 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
2798 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { 2798 rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
2799 if (dev_net(rt->u.dst.dev) != net || idx < s_idx) 2799 if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx)
2800 continue; 2800 continue;
2801 if (rt->rt_genid != atomic_read(&rt_genid)) 2801 if (rt->rt_genid != atomic_read(&rt_genid))
2802 continue; 2802 continue;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 46847e600a46..2a5881c81778 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1974,7 +1974,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
1974 while (1) { 1974 while (1) {
1975 while (req) { 1975 while (req) {
1976 if (req->rsk_ops->family == st->family && 1976 if (req->rsk_ops->family == st->family &&
1977 sock_net(req->sk) == net) { 1977 net_eq(sock_net(req->sk), net)) {
1978 cur = req; 1978 cur = req;
1979 goto out; 1979 goto out;
1980 } 1980 }
@@ -1998,7 +1998,7 @@ get_req:
1998 } 1998 }
1999get_sk: 1999get_sk:
2000 sk_for_each_from(sk, node) { 2000 sk_for_each_from(sk, node) {
2001 if (sk->sk_family == st->family && sock_net(sk) == net) { 2001 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
2002 cur = sk; 2002 cur = sk;
2003 goto out; 2003 goto out;
2004 } 2004 }
@@ -2049,7 +2049,7 @@ static void *established_get_first(struct seq_file *seq)
2049 read_lock_bh(lock); 2049 read_lock_bh(lock);
2050 sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { 2050 sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
2051 if (sk->sk_family != st->family || 2051 if (sk->sk_family != st->family ||
2052 sock_net(sk) != net) { 2052 !net_eq(sock_net(sk), net)) {
2053 continue; 2053 continue;
2054 } 2054 }
2055 rc = sk; 2055 rc = sk;
@@ -2059,7 +2059,7 @@ static void *established_get_first(struct seq_file *seq)
2059 inet_twsk_for_each(tw, node, 2059 inet_twsk_for_each(tw, node,
2060 &tcp_hashinfo.ehash[st->bucket].twchain) { 2060 &tcp_hashinfo.ehash[st->bucket].twchain) {
2061 if (tw->tw_family != st->family || 2061 if (tw->tw_family != st->family ||
2062 twsk_net(tw) != net) { 2062 !net_eq(twsk_net(tw), net)) {
2063 continue; 2063 continue;
2064 } 2064 }
2065 rc = tw; 2065 rc = tw;
@@ -2086,7 +2086,7 @@ static void *established_get_next(struct seq_file *seq, void *cur)
2086 tw = cur; 2086 tw = cur;
2087 tw = tw_next(tw); 2087 tw = tw_next(tw);
2088get_tw: 2088get_tw:
2089 while (tw && (tw->tw_family != st->family || twsk_net(tw) != net)) { 2089 while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
2090 tw = tw_next(tw); 2090 tw = tw_next(tw);
2091 } 2091 }
2092 if (tw) { 2092 if (tw) {
@@ -2107,7 +2107,7 @@ get_tw:
2107 sk = sk_next(sk); 2107 sk = sk_next(sk);
2108 2108
2109 sk_for_each_from(sk, node) { 2109 sk_for_each_from(sk, node) {
2110 if (sk->sk_family == st->family && sock_net(sk) == net) 2110 if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
2111 goto found; 2111 goto found;
2112 } 2112 }
2113 2113
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 76d52d37d6ac..80007c79f12f 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -137,7 +137,7 @@ static inline int __udp_lib_lport_inuse(struct net *net, __u16 num,
137 struct hlist_node *node; 137 struct hlist_node *node;
138 138
139 sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) 139 sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)])
140 if (sock_net(sk) == net && sk->sk_hash == num) 140 if (net_eq(sock_net(sk), net) && sk->sk_hash == num)
141 return 1; 141 return 1;
142 return 0; 142 return 0;
143} 143}
@@ -218,7 +218,7 @@ gotit:
218 sk_for_each(sk2, node, head) 218 sk_for_each(sk2, node, head)
219 if (sk2->sk_hash == snum && 219 if (sk2->sk_hash == snum &&
220 sk2 != sk && 220 sk2 != sk &&
221 sock_net(sk2) == net && 221 net_eq(sock_net(sk2), net) &&
222 (!sk2->sk_reuse || !sk->sk_reuse) && 222 (!sk2->sk_reuse || !sk->sk_reuse) &&
223 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if 223 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
224 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 224 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
@@ -269,7 +269,7 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
269 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { 269 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
270 struct inet_sock *inet = inet_sk(sk); 270 struct inet_sock *inet = inet_sk(sk);
271 271
272 if (sock_net(sk) == net && sk->sk_hash == hnum && 272 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
273 !ipv6_only_sock(sk)) { 273 !ipv6_only_sock(sk)) {
274 int score = (sk->sk_family == PF_INET ? 1 : 0); 274 int score = (sk->sk_family == PF_INET ? 1 : 0);
275 if (inet->rcv_saddr) { 275 if (inet->rcv_saddr) {
@@ -1511,7 +1511,7 @@ static struct sock *udp_get_first(struct seq_file *seq)
1511 for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { 1511 for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
1512 struct hlist_node *node; 1512 struct hlist_node *node;
1513 sk_for_each(sk, node, state->hashtable + state->bucket) { 1513 sk_for_each(sk, node, state->hashtable + state->bucket) {
1514 if (sock_net(sk) != net) 1514 if (!net_eq(sock_net(sk), net))
1515 continue; 1515 continue;
1516 if (sk->sk_family == state->family) 1516 if (sk->sk_family == state->family)
1517 goto found; 1517 goto found;
@@ -1531,7 +1531,7 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
1531 sk = sk_next(sk); 1531 sk = sk_next(sk);
1532try_again: 1532try_again:
1533 ; 1533 ;
1534 } while (sk && (sock_net(sk) != net || sk->sk_family != state->family)); 1534 } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
1535 1535
1536 if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { 1536 if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
1537 sk = sk_head(state->hashtable + state->bucket); 1537 sk = sk_head(state->hashtable + state->bucket);