linux/net/ipv4
Jeff Jo 1b92780ae4 tcp: refresh TS.Recent for accepted old ACKs
A TCP packet can carry new data while acknowledging traffic in the
opposite direction. With overlapping traffic in both directions, a
delayed packet's acknowledgment can be older than one Linux has already
accepted, even when that packet fills a gap in the received data.

Linux accepts the data, but tcp_ack() takes the old_ack path and skips
updating TS.Recent, the timestamp saved for outgoing acknowledgments.
The reply therefore echoes an older timestamp. If the sender uses this
echo to measure round-trip time after a long idle period, its estimate
includes the idle time and can reduce its sending rate.

Update TS.Recent in old_ack using tcp_replace_ts_recent(), before SACK
processing can trigger a transmission. This reuses the existing timestamp
and sequence checks, including PAWS protection against old duplicate
packets. ACK validation already rejects old ACKs in SYN_RECV before this
path, so no additional state check is needed.

Echoing the timestamp of the packet that fills the receive gap follows
RFC 7323 section 4.3. In a socket reproduction with 300 seconds idle,
controlled reordering and retransmission to exercise timestamp-based RTT
sampling, the sender's smoothed round-trip time was 37.5 seconds without
the fix and 15.5 ms with it.

Fixes: 12fb3dd9dc ("tcp: call tcp_replace_ts_recent() from tcp_ack()")
Assisted-by: LLM sparse
Signed-off-by: Jeff Jo <jeffjo@openai.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2026-09-30 08:02:39 +01:00
..
netfilter netfilter: arp_tables: remove the 32bit compat interface 2026-09-07 18:48:52 +02:00
af_inet.c net: gso: limit recursive IP-in-IP segmentation 2026-09-29 12:02:37 +02:00
ah4.c xfrm: ah: use skb_to_full_sk in async output callbacks 2026-05-16 10:56:14 +02:00
arp.c net: arp: terminate device name before lookup 2026-09-23 19:00:15 -07:00
bpf_tcp_ca.c
cipso_ipv4.c
datagram.c raw: annotate lockless match fields in raw_v4_match() 2026-07-23 07:46:12 -07:00
devinet.c net: allow IFLA_INET_CONF messages when NLA_F_NESTED unset 2026-09-18 18:22:59 -07:00
esp4_offload.c
esp4.c ipsec-2026-09-16 2026-09-16 15:54:19 -07:00
fib_frontend.c ipv4: fib: Define fib_table_hash_lock under CONFIG_IP_MULTIPLE_TABLES. 2026-07-07 10:51:06 +02:00
fib_lookup.h
fib_notifier.c
fib_rules.c ipv4: fib: bound automatic table ID allocation 2026-09-03 16:58:32 -07:00
fib_semantics.c ipv4: fib: fix data-race and stale genid check around nh->nh_saddr 2026-09-17 19:19:04 -07:00
fib_trie.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-20 09:18:11 +02:00
fou_bpf.c
fou_core.c fou: reject omitted FOU_ATTR_IPPROTO on FOU_ENCAP_DIRECT 2026-09-23 18:43:08 -07:00
fou_nl.c
fou_nl.h
gre_demux.c
gre_offload.c
icmp.c ipv4: icmp: reject RTN_UNREACHABLE input routes in icmp_route_lookup 2026-09-15 10:20:38 +02:00
igmp_internal.h
igmp.c igmp: convert struct ip_sf_list to RCU 2026-08-31 17:22:03 -07:00
inet_connection_sock.c tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context 2026-09-10 16:58:40 -07:00
inet_diag.c
inet_fragment.c inet: frags: invalidate queues before flushing them 2026-09-09 17:43:03 -07:00
inet_hashtables.c net: remove some unused EXPORT_SYMBOL()s 2026-06-12 16:43:11 -07:00
inet_timewait_sock.c
inetpeer.c inetpeer: randomize RB-tree node comparison using SipHash 2026-08-20 12:55:31 -07:00
ip_forward.c
ip_fragment.c inet: frags: fix use-after-free caused by the fqdir_pre_exit() flush 2026-06-04 18:05:23 -07:00
ip_gre.c ip_gre: Reject enabling collect metadata through changelink 2026-09-23 19:17:46 -07:00
ip_input.c
ip_options.c ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options 2026-06-03 18:53:14 -07:00
ip_output.c net: ipv4: Fix UDP length overflow with PMTU discover and big MTU 2026-09-07 17:13:55 -07:00
ip_sockglue.c
ip_tunnel_core.c net: ip_tunnel: initialize options_len before referencing options 2026-09-15 17:34:31 -07:00
ip_tunnel.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
ip_vti.c net: ip_vti: require CAP_NET_ADMIN in the device netns for changelink 2026-06-17 16:01:52 -07:00
ipcomp.c xfrm: add extack to xfrm_init_state 2026-06-04 12:22:35 +02:00
ipconfig.c net: ipconfig: bound DHCP option construction 2026-09-24 10:57:51 +02:00
ipip.c ipip: fix skb leak in collect_md mode when metadata_dst allocation fails 2026-08-22 13:03:10 -07:00
ipmr_base.c ipmr: account multicast table and route memory 2026-09-10 08:48:44 -07:00
ipmr.c ipmr: account multicast table and route memory 2026-09-10 08:48:44 -07:00
Kconfig net/tcp: Remove tcp_sigpool 2026-04-30 09:38:56 +02:00
Makefile netfilter: add option for GCOV profiling 2026-05-24 22:55:47 +02:00
metrics.c
netfilter.c
netlink.c
nexthop.c nexthop: Initialize extack in remove_nh_grp_entry() 2026-09-04 15:17:41 -07:00
ping.c
proc.c
protocol.c
raw_diag.c
raw.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-23 14:07:40 -07:00
route.c net: advertise TCP MSS from the configured MTU, not the learned PMTU 2026-08-20 12:14:23 -07:00
syncookies.c tcp: rehash onto different local ECMP path on retransmit timeout 2026-06-15 15:57:31 -07:00
sysctl_net_ipv4.c tcp: do not let tcp_rmem be set below 4096 2026-09-15 15:21:17 +02:00
tcp_ao.c tcp: fix AO info use-after-free in tcp_ao_connect_init() 2026-08-27 12:10:55 +02:00
tcp_bbr.c tcp_bbr: fix SPDX-License-Identifier to be GPL-2.0 OR BSD-3-Clause 2026-06-01 16:51:08 -07:00
tcp_bic.c
tcp_bpf.c bpf, sockmap: Fix sk_redir use-after-free in send verdict 2026-08-01 18:24:58 +02:00
tcp_cdg.c
tcp_cong.c tcp: fix use-after-free in do_tcp_getsockopt(TCP_CONGESTION) 2026-08-28 16:09:02 -07:00
tcp_cubic.c
tcp_dctcp.c tcp: fix use-after-free in do_tcp_getsockopt(TCP_CC_INFO) 2026-08-28 16:09:02 -07:00
tcp_dctcp.h
tcp_diag.c
tcp_fastopen.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: refresh TS.Recent for accepted old ACKs 2026-09-30 08:02:39 +01:00
tcp_ipv4.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
tcp_lp.c
tcp_metrics.c
tcp_minisocks.c tcp: fix use-after-free in do_tcp_getsockopt(TCP_CONGESTION) 2026-08-28 16:09:02 -07:00
tcp_nv.c
tcp_offload.c net: gro: Fix nesting of TCP GSO SKBs in skb_gro_receive_list() 2026-09-03 12:20:38 +02:00
tcp_output.c tcp: fix use-after-free of retransmit_skb_hint in tcp_send_synack() 2026-09-24 09:17:10 -07:00
tcp_plb.c tcp: rehash onto different local ECMP path on retransmit timeout 2026-06-15 15:57:31 -07:00
tcp_recovery.c
tcp_scalable.c
tcp_timer.c tcp: use GFP_ATOMIC in tcp_send_active_reset() 2026-08-28 15:35:38 -07:00
tcp_ulp.c net: psp: avoid conflicts with skb->decrypted and sk_validate_xmit_skb() 2026-09-16 19:18:24 -07:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tcp.c tcp: reject non zerocopy devmem tx 2026-09-10 14:45:57 +02:00
tunnel4.c
udp_bpf.c sockmap: Fix use-after-free in udp_bpf_recvmsg() 2026-06-14 21:30:20 -07:00
udp_diag.c
udp_offload.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-06 11:53:47 -07:00
udp_tunnel_core.c udp: Set length in UDP header to 0 for big GSO packets 2026-07-22 13:47:02 +02:00
udp_tunnel_nic.c net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister() 2026-07-28 13:32:34 +02:00
udp_tunnel_stub.c
udp.c udp: remove a disconnected socket from the 4-tuple hash table 2026-09-22 10:57:53 +02:00
xfrm4_input.c xfrm: Fix dev use-after-free in xfrm async resumption 2026-06-12 08:39:59 +02:00
xfrm4_output.c
xfrm4_policy.c net: Const qualify network templated ctl_tables Arrays 2026-08-13 13:12:24 +02:00
xfrm4_protocol.c
xfrm4_state.c
xfrm4_tunnel.c