Re: [TCP] Update ext2_header_len when dst changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 17 Aug 2003 22:45:46 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> This patch updates ext2_header_len which is needed when dst changes.
> Without this TCP connections started before IPSEC SAs are set up will
> hang when they try to send large packets.

Thanks for pointing out this bug.

I believe the patch at the end of this email is a better fix.

Note, this turned up a bunch of bugs in TCP/ipv6:

1) Failure to set sk->route_caps on sk dst set in
   tcp_v6_xmit().
2) Setting sk->route_caps on wrong socket in
   tcp_v6_syn_recv_sock

These are also fixed here.

(Alexey, maybe some day we'll add a dst->ops->sk_set_dst()?)

--- net/ipv4/tcp_ipv4.c.~1~	Sun Aug 17 23:44:28 2003
+++ net/ipv4/tcp_ipv4.c	Sun Aug 17 23:45:37 2003
@@ -1884,6 +1884,7 @@ static int tcp_v4_reselect_saddr(struct 
 
 	__sk_dst_set(sk, &rt->u.dst);
 	tcp_v4_setup_caps(sk, &rt->u.dst);
+	tcp_sk(sk)->ext2_header_len = rt->u.dst.header_len;
 
 	new_saddr = rt->rt_src;
 
@@ -1943,6 +1944,7 @@ int tcp_v4_rebuild_header(struct sock *s
 	if (!err) {
 		__sk_dst_set(sk, &rt->u.dst);
 		tcp_v4_setup_caps(sk, &rt->u.dst);
+		tcp_sk(sk)->ext2_header_len = rt->u.dst.header_len;
 		return 0;
 	}
 
--- net/ipv6/tcp_ipv6.c.~1~	Sun Aug 17 23:44:28 2003
+++ net/ipv6/tcp_ipv6.c	Sun Aug 17 23:51:55 2003
@@ -686,7 +686,7 @@ static int tcp_v6_connect(struct sock *s
 
 	ip6_dst_store(sk, dst, NULL);
 	sk->sk_route_caps = dst->dev->features &
-			    ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+		~(NETIF_F_IP_CSUM | NETIF_F_TSO);
 
 	tp->ext_header_len = 0;
 	if (np->opt)
@@ -1347,8 +1347,8 @@ static struct sock * tcp_v6_syn_recv_soc
 #endif
 
 	ip6_dst_store(newsk, dst, NULL);
-	sk->sk_route_caps = dst->dev->features &
-			    ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+	newsk->sk_route_caps = dst->dev->features &
+		~(NETIF_F_IP_CSUM | NETIF_F_TSO);
 
 	newtcp6sk = (struct tcp6_sock *)newsk;
 	newtcp6sk->pinet6 = &newtcp6sk->inet6;
@@ -1741,7 +1741,8 @@ static int tcp_v6_rebuild_header(struct 
 
 		ip6_dst_store(sk, dst, NULL);
 		sk->sk_route_caps = dst->dev->features &
-				    ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+			~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+		tcp_sk(sk)->ext2_header_len = dst->header_len;
 	}
 
 	return 0;
@@ -1782,6 +1783,9 @@ static int tcp_v6_xmit(struct sk_buff *s
 		}
 
 		ip6_dst_store(sk, dst, NULL);
+		sk->sk_route_caps = dst->dev->features &
+			~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+		tcp_sk(sk)->ext2_header_len = dst->header_len;
 	}
 
 	skb->dst = dst_clone(dst);
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux