diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-03-07 14:16:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-07 14:16:26 -0500 |
commit | e504799276e53045a9b597f24c1b456552482f63 (patch) | |
tree | cc2578f8e66c7d2659d740f189db572e6c9bed9f /net/ipv6/tcp_ipv6.c | |
parent | 93ec926b075d14bb7edcbc054e92199e9ad4ad1d (diff) |
[NETNS][IPV6] tcp6 - handle several network namespace
We have the right network namespace at the right place now.
So make use of this information to make tcp6 per network namespace
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7954b4e99c4f..caf0cc1c00e1 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -988,6 +988,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
988 | struct tcphdr *th = tcp_hdr(skb), *t1; | 988 | struct tcphdr *th = tcp_hdr(skb), *t1; |
989 | struct sk_buff *buff; | 989 | struct sk_buff *buff; |
990 | struct flowi fl; | 990 | struct flowi fl; |
991 | struct net *net = skb->dst->dev->nd_net; | ||
992 | struct sock *ctl_sk = net->ipv6.tcp_sk; | ||
991 | unsigned int tot_len = sizeof(*th); | 993 | unsigned int tot_len = sizeof(*th); |
992 | #ifdef CONFIG_TCP_MD5SIG | 994 | #ifdef CONFIG_TCP_MD5SIG |
993 | struct tcp_md5sig_key *key; | 995 | struct tcp_md5sig_key *key; |
@@ -1072,11 +1074,10 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1072 | * Underlying function will use this to retrieve the network | 1074 | * Underlying function will use this to retrieve the network |
1073 | * namespace | 1075 | * namespace |
1074 | */ | 1076 | */ |
1075 | if (!ip6_dst_lookup(init_net.ipv6.tcp_sk, &buff->dst, &fl)) { | 1077 | if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) { |
1076 | 1078 | ||
1077 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { | 1079 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { |
1078 | ip6_xmit(init_net.ipv6.tcp_sk, | 1080 | ip6_xmit(ctl_sk, buff, &fl, NULL, 0); |
1079 | buff, &fl, NULL, 0); | ||
1080 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 1081 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
1081 | TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); | 1082 | TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); |
1082 | return; | 1083 | return; |
@@ -1092,6 +1093,8 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1092 | struct tcphdr *th = tcp_hdr(skb), *t1; | 1093 | struct tcphdr *th = tcp_hdr(skb), *t1; |
1093 | struct sk_buff *buff; | 1094 | struct sk_buff *buff; |
1094 | struct flowi fl; | 1095 | struct flowi fl; |
1096 | struct net *net = skb->dev->nd_net; | ||
1097 | struct sock *ctl_sk = net->ipv6.tcp_sk; | ||
1095 | unsigned int tot_len = sizeof(struct tcphdr); | 1098 | unsigned int tot_len = sizeof(struct tcphdr); |
1096 | __be32 *topt; | 1099 | __be32 *topt; |
1097 | #ifdef CONFIG_TCP_MD5SIG | 1100 | #ifdef CONFIG_TCP_MD5SIG |
@@ -1173,10 +1176,9 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1173 | fl.fl_ip_sport = t1->source; | 1176 | fl.fl_ip_sport = t1->source; |
1174 | security_skb_classify_flow(skb, &fl); | 1177 | security_skb_classify_flow(skb, &fl); |
1175 | 1178 | ||
1176 | if (!ip6_dst_lookup(init_net.ipv6.tcp_sk, &buff->dst, &fl)) { | 1179 | if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) { |
1177 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { | 1180 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { |
1178 | ip6_xmit(init_net.ipv6.tcp_sk, | 1181 | ip6_xmit(ctl_sk, buff, &fl, NULL, 0); |
1179 | buff, &fl, NULL, 0); | ||
1180 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 1182 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
1181 | return; | 1183 | return; |
1182 | } | 1184 | } |