From f8d1f5ed4de2ab01e0d2d922813a78902a6f1d40 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 17 Aug 2003 10:06:49 -0700 Subject: [PATCH] [TCP]: When socket route changes, do not forget to update ext2_header_len and sk_route_caps. Based upon a patch from Herbert Xu (herbert@gondor.apana.org.au). --- net/ipv4/tcp_ipv4.c | 2 ++ net/ipv6/tcp_ipv6.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 1a74f72df3185..8ca91d91f3609 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1884,6 +1884,7 @@ static int tcp_v4_reselect_saddr(struct sock *sk) __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 *sk) 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; } diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 4d16e99a8e849..0f27706023fcd 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -686,7 +686,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, 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_sock(struct sock *sk, struct sk_buff *skb, #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 sock *sk) 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 *skb, int ipfragok) } 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); -- 2.53.0