On 11/28/26 4:06 PM, Kuniyuki Iwashima wrote:
> TCP_SYN_SENT and TCP_SYN_RECV sockets treat ICMP soft errors > as hard errors as mentioned in RFC 5461 Section 4.1. > > Commit 9cf7490360bf ("tcp: do not drop syn_recv on all icmp > reports") introduced the abort arg to tcp_req_err() to avoid > aborting TCP_NEW_SYN_RECV reqsk on ICMP_REDIRECT and > ICMP_FRAG_NEEDED. > > However, tcp_v4_err() only checks ICMP_NET_UNREACH and > ICMP_HOST_UNREACH under ICMP_DEST_UNREACH and ignores other > codes such as ICMP_PORT_UNREACH. > > For example, we can see SYN+ACK retransmitted after receiving > hard error: > > --ip_version=ipv4 > 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 > +0 bind(3, ..., ...) = 0 > +0 listen(3, 10) = 0 > > +0 < S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK> > +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK> > +0 < icmp unreachable port_unreachable [0:0(0)] > +1 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK> > > Similarly, tcp_v6_err() passes fatal from icmpv6_err_convert() > and ignores soft errors such as ICMPV6_TIME_EXCEED, ICMPV6_NOROUTE, > and ICMPV6_ADDR_UNREACH. > > Let's abort reqsk on ICMP_DEST_UNREACH (except ICMP_FRAG_NEEDED), > ICMP_TIME_EXCEEDED, and ICMP_PARAMETERPROB (and their IPv6 > equivalents) to match TCP_SYN_SENT and TCP_SYN_RECV. > > Fixes: 9cf7490360bf ("tcp: do not drop syn_recv on all icmp reports") > Signed-off-by: Kuniyuki Iwashima <kuni…@google.com> > --- > v2: Change not to ignore hard error instead of following RFC 1122 > ---
Reviewed-by: Jiayuan Chen <jiay…@linux.dev>