linux-kernelorg-stable/net
Eric Dumazet 3ba075278c tcp: be less liberal in TSEcr received while in SYN_RECV state
Yong-Hao Zou mentioned that linux was not strict as other OS in 3WHS,
for flows using TCP TS option (RFC 7323)

As hinted by an old comment in tcp_check_req(),
we can check the TSEcr value in the incoming packet corresponds
to one of the SYNACK TSval values we have sent.

In this patch, I record the oldest and most recent values
that SYNACK packets have used.

Send a challenge ACK if we receive a TSEcr outside
of this range, and increase a new SNMP counter.

nstat -az | grep TSEcrRejected
TcpExtTSEcrRejected            0                  0.0

Due to TCP fastopen implementation, do not apply yet these checks
for fastopen flows.

v2: No longer use req->num_timeout, but treq->snt_tsval_first
    to detect when first SYNACK is prepared. This means
    we make sure to not send an initial zero TSval.
    Make sure MPTCP and TCP selftests are passing.
    Change MIB name to TcpExtTSEcrRejected

v1: https://lore.kernel.org/netdev/CADVnQykD8i4ArpSZaPKaoNxLJ2if2ts9m4As+=Jvdkrgx1qMHw@mail.gmail.com/T/

Reported-by: Yong-Hao Zou <yonghaoz1994@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250225171048.3105061-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-26 18:11:17 -08:00
..
6lowpan
9p
802
8021q net: Use link/peer netns in newlink() of rtnl_link_ops 2025-02-21 15:28:02 -08:00
appletalk
atm
ax25 ax25: Fix refcount leak caused by setting SO_BINDTODEVICE sockopt 2025-02-06 17:02:40 -08:00
batman-adv rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
bluetooth Including fixes from netfilter, wireless and bluetooth. 2025-02-13 12:17:04 -08:00
bpf
bridge rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
caif rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
can net: initialize mark in sockcm_init 2025-02-18 18:27:19 -08:00
ceph
core net: Remove shadow variable in netdev_run_todo() 2025-02-24 14:34:54 -08:00
dcb
dccp inet: consolidate inet_csk_clone_lock() 2025-02-14 13:40:33 -08:00
devlink
dns_resolver
dsa bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback 2025-02-20 14:29:36 -08:00
ethernet
ethtool ethtool: Symmetric OR-XOR RSS hash 2025-02-25 18:31:04 -08:00
handshake
hsr net: Use link/peer netns in newlink() of rtnl_link_ops 2025-02-21 15:28:02 -08:00
ieee802154 ieee802154: 6lowpan: Validate link netns in newlink() of rtnl_link_ops 2025-02-21 15:28:02 -08:00
ife
ipv4 tcp: be less liberal in TSEcr received while in SYN_RECV state 2025-02-26 18:11:17 -08:00
ipv6 ipv6: fib_rules: Add DSCP mask matching 2025-02-21 16:08:48 -08:00
iucv
kcm
key
l2tp ipv6: replace ipcm6_init calls with ipcm6_init_sk 2025-02-18 18:27:20 -08:00
l3mdev
lapb
llc
mac80211
mac802154
mctp
mpls
mptcp mptcp: blackhole: avoid checking the state twice 2025-02-24 18:23:44 -08:00
ncsi
netfilter Revert "netfilter: flowtable: teardown flow if cached mtu is stale" 2025-02-12 10:35:20 +01:00
netlabel
netlink netlink: Unset cb_running when terminating dump on release 2025-02-18 18:03:12 -08:00
netrom
nfc nfc: hci: Remove unused nfc_llc_unregister 2025-02-19 19:04:26 -08:00
nsh
openvswitch openvswitch: use RCU protection in ovs_vport_cmd_fill_info() 2025-02-10 18:09:09 -08:00
packet net: initialize mark in sockcm_init 2025-02-18 18:27:19 -08:00
phonet
psample
qrtr
rds net/rds: Replace deprecated strncpy() with strscpy_pad() 2025-02-21 15:51:26 -08:00
rfkill
rose
rxrpc rxrpc: Fix ipv6 path MTU discovery 2025-02-13 10:00:12 -08:00
sched ip_tunnel: Use ip_tunnel_info() helper instead of 'info + 1' 2025-02-20 13:17:16 -08:00
sctp sctp: Fix undefined behavior in left shift operation 2025-02-19 18:55:40 -08:00
shaper
smc
strparser
sunrpc
switchdev
tipc
tls
unix af_unix: Fix undefined 'other' error 2025-02-20 15:28:46 -08:00
vmw_vsock vsock/bpf: Warn on socket without transport 2025-02-18 12:00:01 +01:00
wireless
x25
xdp bpf-next-for-netdev 2025-02-21 15:59:47 -08:00
xfrm net: xfrm: Use link netns in newlink() of rtnl_link_ops 2025-02-21 15:28:03 -08:00
Kconfig
Kconfig.debug
Makefile
compat.c
devres.c
socket.c bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback 2025-02-20 14:29:36 -08:00
sysctl_net.c