aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-31 08:07:21 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:28:20 -0500
commitd86e0dac2ce412715181f792aa0749fe3effff11 (patch)
treebc9197a7316c7d7641112d5f5975d8b91afdbd08 /include
parentc67499c0e772064b37ad75eb69b28fc218752636 (diff)
[NETNS]: Tcp-v6 sockets per-net lookup.
Add a net argument to inet6_lookup and propagate it further. Actually, this is tcp-v6 implementation of what was done for tcp-v4 sockets in a previous patch. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ipv6.h8
-rw-r--r--include/net/inet6_hashtables.h17
2 files changed, 14 insertions, 11 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index c34786044a1b..4aaefc349a4b 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -457,16 +457,16 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
457#define inet_v6_ipv6only(__sk) 0 457#define inet_v6_ipv6only(__sk) 0
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 459
460#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && \ 461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 463 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 467
468#define INET6_TW_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif) \ 468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && \ 469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \ 471 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 668056b4bb0b..fdff630708ce 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -57,34 +57,37 @@ extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
57 * 57 *
58 * The sockhash lock must be held as a reader here. 58 * The sockhash lock must be held as a reader here.
59 */ 59 */
60extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 60extern struct sock *__inet6_lookup_established(struct net *net,
61 struct inet_hashinfo *hashinfo,
61 const struct in6_addr *saddr, 62 const struct in6_addr *saddr,
62 const __be16 sport, 63 const __be16 sport,
63 const struct in6_addr *daddr, 64 const struct in6_addr *daddr,
64 const u16 hnum, 65 const u16 hnum,
65 const int dif); 66 const int dif);
66 67
67extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 68extern struct sock *inet6_lookup_listener(struct net *net,
69 struct inet_hashinfo *hashinfo,
68 const struct in6_addr *daddr, 70 const struct in6_addr *daddr,
69 const unsigned short hnum, 71 const unsigned short hnum,
70 const int dif); 72 const int dif);
71 73
72static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo, 74static inline struct sock *__inet6_lookup(struct net *net,
75 struct inet_hashinfo *hashinfo,
73 const struct in6_addr *saddr, 76 const struct in6_addr *saddr,
74 const __be16 sport, 77 const __be16 sport,
75 const struct in6_addr *daddr, 78 const struct in6_addr *daddr,
76 const u16 hnum, 79 const u16 hnum,
77 const int dif) 80 const int dif)
78{ 81{
79 struct sock *sk = __inet6_lookup_established(hashinfo, saddr, sport, 82 struct sock *sk = __inet6_lookup_established(net, hashinfo, saddr,
80 daddr, hnum, dif); 83 sport, daddr, hnum, dif);
81 if (sk) 84 if (sk)
82 return sk; 85 return sk;
83 86
84 return inet6_lookup_listener(hashinfo, daddr, hnum, dif); 87 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
85} 88}
86 89
87extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 90extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
88 const struct in6_addr *saddr, const __be16 sport, 91 const struct in6_addr *saddr, const __be16 sport,
89 const struct in6_addr *daddr, const __be16 dport, 92 const struct in6_addr *daddr, const __be16 dport,
90 const int dif); 93 const int dif);