diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 14:57:35 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-25 15:40:00 -0400 |
commit | 878628fbf2589eb24357e42027d5f54b1dafd3c8 (patch) | |
tree | 30c109d8f337b3910e3b5364877c3c521dd700b5 /net/ipv4/udp.c | |
parent | 57da52c1e62c6c13875e97de6c69d3156f8416da (diff) |
[NET] NETNS: Omit namespace comparision without CONFIG_NET_NS.
Introduce an inline net_eq() to compare two namespaces.
Without CONFIG_NET_NS, since no namespace other than &init_net
exists, it is always 1.
We do not need to convert 1) inline vs inline and
2) inline vs &init_net comparisons.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 10 |
1 files changed, 5 insertions, 5 deletions
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); |
1532 | try_again: | 1532 | try_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); |