Re: [PATCH 5/6][NETNS]: Tcp-v6 sockets per-net lookup.

2008-01-31 Thread David Miller
From: Pavel Emelyanov <[EMAIL PROTECTED]>
Date: Thu, 31 Jan 2008 15:40:16 +0300

> 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 <[EMAIL PROTECTED]>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6][NETNS]: Tcp-v6 sockets per-net lookup.

2008-01-31 Thread Pavel Emelyanov
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 <[EMAIL PROTECTED]>

---
 include/linux/ipv6.h   |8 
 include/net/inet6_hashtables.h |   17 ++---
 net/dccp/ipv6.c|8 
 net/ipv4/inet_diag.c   |2 +-
 net/ipv6/inet6_hashtables.c|   25 ++---
 net/ipv6/tcp_ipv6.c|   19 ++-
 6 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index c347860..4aaefc3 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)
 #define inet_v6_ipv6only(__sk) 0
 #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
 
-#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\
-   (((__sk)->sk_hash == (__hash))  && \
+#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
+   (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net))   && \
 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))  && \
 ((__sk)->sk_family == AF_INET6)&& \
 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif
 
-#define INET6_TW_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif) \
-   (((__sk)->sk_hash == (__hash))  && \
+#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
+   (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net))   && \
 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports))   && \
 ((__sk)->sk_family== PF_INET6) && \
 (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 668056b..fdff630 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);
  *
  * The sockhash lock must be held as a reader here.
  */
-extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
+extern struct sock *__inet6_lookup_established(struct net *net,
+  struct inet_hashinfo *hashinfo,
   const struct in6_addr *saddr,
   const __be16 sport,
   const struct in6_addr *daddr,
   const u16 hnum,
   const int dif);
 
-extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
+extern struct sock *inet6_lookup_listener(struct net *net,
+ struct inet_hashinfo *hashinfo,
  const struct in6_addr *daddr,
  const unsigned short hnum,
  const int dif);
 
-static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
+static inline struct sock *__inet6_lookup(struct net *net,
+ struct inet_hashinfo *hashinfo,
  const struct in6_addr *saddr,
  const __be16 sport,
  const struct in6_addr *daddr,
  const u16 hnum,
  const int dif)
 {
-   struct sock *sk = __inet6_lookup_established(hashinfo, saddr, sport,
-daddr, hnum, dif);
+   struct sock *sk = __inet6_lookup_established(net, hashinfo, saddr,
+   sport, daddr, hnum, dif);
if (sk)
return sk;
 
-   return inet6_lookup_listener(hashinfo, daddr, hnum, dif);
+   return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
 }
 
-extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
+extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo 
*hashinfo,
 const struct in6_addr *saddr, const __be16 
sport,
 const struct in6_addr *daddr, const __be16 
dport,
 const int dif);
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index f42b75c..ed0a005 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -101,8 +101,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct