Re: [PATCH net] ipv6: tcp: drop silly ICMPv6 packet too big messages
From: Eric Dumazet <edumazet@google.com>
Date: 2021-07-08 05:52:40
On Thu, Jul 8, 2021 at 12:26 AM Martin KaFai Lau [off-list ref] wrote:
On Wed, Jul 07, 2021 at 08:46:30AM -0700, Eric Dumazet wrote: [ ... ]quoted
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 593c32fe57ed13a218492fd6056f2593e601ec79..bc334a6f24992c7b5b2c415eab4b6cf51bf36cb4 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c@@ -348,11 +348,20 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, static void tcp_v6_mtu_reduced(struct sock *sk) { struct dst_entry *dst; + u32 mtu; if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) return; - dst = inet6_csk_update_pmtu(sk, READ_ONCE(tcp_sk(sk)->mtu_info)); + mtu = READ_ONCE(tcp_sk(sk)->mtu_info); + + /* Drop requests trying to increase our current mss. + * Check done in __ip6_rt_update_pmtu() is too late. + */ + if (tcp_mss_to_mtu(sk, mtu) >= tcp_sk(sk)->mss_cache)Instead of tcp_mss_to_mtu, should this be calling tcp_mtu_to_mss to compare with tcp_sk(sk)->mss_cache?
Good catch Martin, let me add and run a few more tests before sending a v2. Thanks !