diff options
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r-- | include/net/inet_hashtables.h | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 97dc35ad09be..735b926a3497 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -221,26 +221,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | /* Caller must disable local BH processing. */ | 223 | /* Caller must disable local BH processing. */ |
224 | static inline void __inet_inherit_port(struct sock *sk, struct sock *child) | 224 | extern void __inet_inherit_port(struct sock *sk, struct sock *child); |
225 | { | ||
226 | struct inet_hashinfo *table = sk->sk_prot->hashinfo; | ||
227 | const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); | ||
228 | struct inet_bind_hashbucket *head = &table->bhash[bhash]; | ||
229 | struct inet_bind_bucket *tb; | ||
230 | |||
231 | spin_lock(&head->lock); | ||
232 | tb = inet_csk(sk)->icsk_bind_hash; | ||
233 | sk_add_bind_node(child, &tb->owners); | ||
234 | inet_csk(child)->icsk_bind_hash = tb; | ||
235 | spin_unlock(&head->lock); | ||
236 | } | ||
237 | |||
238 | static inline void inet_inherit_port(struct sock *sk, struct sock *child) | ||
239 | { | ||
240 | local_bh_disable(); | ||
241 | __inet_inherit_port(sk, child); | ||
242 | local_bh_enable(); | ||
243 | } | ||
244 | 225 | ||
245 | extern void inet_put_port(struct sock *sk); | 226 | extern void inet_put_port(struct sock *sk); |
246 | 227 | ||
@@ -314,25 +295,25 @@ typedef __u64 __bitwise __addrpair; | |||
314 | ((__force __u64)(__be32)(__saddr))); | 295 | ((__force __u64)(__be32)(__saddr))); |
315 | #endif /* __BIG_ENDIAN */ | 296 | #endif /* __BIG_ENDIAN */ |
316 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 297 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
317 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 298 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
318 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 299 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ |
319 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 300 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
320 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 301 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
321 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 302 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
322 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 303 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
323 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ | 304 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ |
324 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 305 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
326 | #else /* 32-bit arch */ | 307 | #else /* 32-bit arch */ |
327 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 308 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
328 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ | 309 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ |
329 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 310 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
330 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 311 | (inet_sk(__sk)->daddr == (__saddr)) && \ |
331 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 312 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ |
332 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 313 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
333 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 314 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
334 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 315 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
335 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 316 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
336 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ | 317 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ |
337 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ | 318 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ |
338 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 319 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |