Need to adjust MSS to account for encapsulation overhead. This is done by add encpasulation header length into icsk_ext_hdr_len.
Signed-off-by: Tom Herbert <t...@herbertland.com> --- net/ipv6/tcp_ipv6.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index f36c2d0..eb67da7 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -62,6 +62,7 @@ #include <net/inet_common.h> #include <net/secure_seq.h> #include <net/busy_poll.h> +#include <net/tou.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> @@ -210,7 +211,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, err = tcp_v4_connect(sk, (struct sockaddr *)&sin, sizeof(sin)); if (err) { - icsk->icsk_ext_hdr_len = exthdrlen; + icsk->icsk_ext_hdr_len = tou_hdr_len(sk) + exthdrlen; icsk->icsk_af_ops = &ipv6_specific; sk->sk_backlog_rcv = tcp_v6_do_rcv; #ifdef CONFIG_TCP_MD5SIG @@ -262,9 +263,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, ipv6_addr_equal(&fl6.daddr, &sk->sk_v6_daddr)) tcp_fetch_timewait_stamp(sk, dst); - icsk->icsk_ext_hdr_len = 0; + icsk->icsk_ext_hdr_len = tou_hdr_len(sk); if (opt) - icsk->icsk_ext_hdr_len = opt->opt_flen + + icsk->icsk_ext_hdr_len += opt->opt_flen + opt->opt_nflen; tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); @@ -1114,9 +1115,9 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * opt = ipv6_dup_options(newsk, opt); RCU_INIT_POINTER(newnp->opt, opt); } - inet_csk(newsk)->icsk_ext_hdr_len = 0; + inet_csk(newsk)->icsk_ext_hdr_len = tou_hdr_len(sk); if (opt) - inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen + + inet_csk(newsk)->icsk_ext_hdr_len += opt->opt_nflen + opt->opt_flen; tcp_ca_openreq_child(newsk, dst); -- 2.8.0.rc2