浏览代码

ipv6: adapt connect for repair move

This is work the same as for ipv4.

All other hacks about tcp repair are in common code for ipv4 and ipv6,
so this patch is enough for repairing ipv6 connections.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Andrey Vagin 13 年之前
父节点
当前提交
2b9164771e
共有 3 个文件被更改,包括 7 次插入13 次删除
  1. 1 12
      net/ipv4/tcp_ipv4.c
  2. 5 0
      net/ipv4/tcp_output.c
  3. 1 1
      net/ipv6/tcp_ipv6.c

+ 1 - 12
net/ipv4/tcp_ipv4.c

@@ -138,14 +138,6 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
 }
 }
 EXPORT_SYMBOL_GPL(tcp_twsk_unique);
 EXPORT_SYMBOL_GPL(tcp_twsk_unique);
 
 
-static int tcp_repair_connect(struct sock *sk)
-{
-	tcp_connect_init(sk);
-	tcp_finish_connect(sk, NULL);
-
-	return 0;
-}
-
 /* This will initiate an outgoing connection. */
 /* This will initiate an outgoing connection. */
 int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 {
 {
@@ -250,10 +242,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
 
 	inet->inet_id = tp->write_seq ^ jiffies;
 	inet->inet_id = tp->write_seq ^ jiffies;
 
 
-	if (likely(!tp->repair))
-		err = tcp_connect(sk);
-	else
-		err = tcp_repair_connect(sk);
+	err = tcp_connect(sk);
 
 
 	rt = NULL;
 	rt = NULL;
 	if (err)
 	if (err)

+ 5 - 0
net/ipv4/tcp_output.c

@@ -2987,6 +2987,11 @@ int tcp_connect(struct sock *sk)
 
 
 	tcp_connect_init(sk);
 	tcp_connect_init(sk);
 
 
+	if (unlikely(tp->repair)) {
+		tcp_finish_connect(sk, NULL);
+		return 0;
+	}
+
 	buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation);
 	buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation);
 	if (unlikely(buff == NULL))
 	if (unlikely(buff == NULL))
 		return -ENOBUFS;
 		return -ENOBUFS;

+ 1 - 1
net/ipv6/tcp_ipv6.c

@@ -295,7 +295,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	if (err)
 	if (err)
 		goto late_failure;
 		goto late_failure;
 
 
-	if (!tp->write_seq)
+	if (!tp->write_seq && likely(!tp->repair))
 		tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32,
 		tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32,
 							     np->daddr.s6_addr32,
 							     np->daddr.s6_addr32,
 							     inet->inet_sport,
 							     inet->inet_sport,