Skip to contentSkip to conversation

tcp: fix TCP_MAXSEG for established IPv6 passive sockets

PATCH In review Neal Cardwell 3 participants 3 messages Apr 22, 2012

Subsystems (3)
lore
Share & tools
lore

Neal Cardwell

author maintainer
#0 lore raw

PATCH 1/1 tcp: fix TCP_MAXSEG for established IPv6 passive sockets

Commit f5fff5d forgot to fix TCP_MAXSEG behavior IPv6 sockets, so IPv6 TCP server sockets that used TCP_MAXSEG would find that the advmss of child sockets would be incorrect. This commit mirrors the advmss logic from tcp_v4_syn_recv_sock in tcp_v6_syn_recv_sock. Eventually this logic should probably be shared between IPv4 and IPv6, but this at least fixes this issue.

---
 net/ipv6/tcp_ipv6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/ipv6/tcp_ipv6.c +4 -0
index 86cfe60..98256cf 100644
@@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
 	tcp_mtup_init(newsk);
 	tcp_sync_mss(newsk, dst_mtu(dst));
 	newtp->advmss = dst_metric_advmss(dst);
+	if (tcp_sk(sk)->rx_opt.user_mss &&
+	    tcp_sk(sk)->rx_opt.user_mss < newtp->advmss)
+		newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
+
 	tcp_initialize_rcv_mss(newsk);
 	if (tcp_rsk(req)->snt_synack)
 		tcp_valid_rtt_meas(newsk,
Signature · 1 line
1.7.7.3
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Neal Cardwell

Commit f5fff5d forgot to fix TCP_MAXSEG behavior IPv6 sockets, so IPv6 TCP server sockets that used TCP_MAXSEG would find that the advmss of child sockets would be incorrect. This commit mirrors the advmss logic from tcp_v4_syn_recv_sock in tcp_v6_syn_recv_sock. Eventually this logic should probably be shared between IPv4 and IPv6, but this at least fixes this issue.

---
 net/ipv6/tcp_ipv6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/ipv6/tcp_ipv6.c +0 -0
index 86cfe60..98256cf 100644

net/ipv6/tcp_ipv6.c static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, · line 1392

Quoted 10 lines
net/ipv6/tcp_ipv6.c +4 -0
@@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
 	tcp_mtup_init(newsk);
 	tcp_sync_mss(newsk, dst_mtu(dst));
 	newtp->advmss = dst_metric_advmss(dst);
+	if (tcp_sk(sk)->rx_opt.user_mss &&
+	    tcp_sk(sk)->rx_opt.user_mss < newtp->advmss)
+		newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
+
 	tcp_initialize_rcv_mss(newsk);
 	if (tcp_rsk(req)->snt_synack)
 		tcp_valid_rtt_meas(newsk,
maintainer
#2 lore raw

From: Eric Dumazet <[email protected]>
Date: Sun, 22 Apr 2012 22:14:54 +0200

Quoted 9 lines · Neal Cardwell
Quoted 8 lines

Commit f5fff5d forgot to fix TCP_MAXSEG behavior IPv6 sockets, so IPv6 TCP server sockets that used TCP_MAXSEG would find that the advmss of child sockets would be incorrect. This commit mirrors the advmss logic from tcp_v4_syn_recv_sock in tcp_v6_syn_recv_sock. Eventually this logic should probably be shared between IPv4 and IPv6, but this at least fixes this issue.

...

Quoted 1 line

Applied and queued up for -stable, thanks.