Article View: linux.kernel.netdev
Article #3571Re: [RFC PATCH net-next 2/4] tcp: add BPF_SOCK_OPS_TCP_TS_ID_CB to assign a TSval identifier
From: Jason Xing
Date: Thu, 15 Oct 2026 12:12
Date: Thu, 15 Oct 2026 12:12
58 lines
12008 bytes
12008 bytes
On Thu, Oct 15, 2026 at 1:51 AM Jakub Sitnicki <jakub@cloudflare.com> wrote: > > On Tue, Oct 13, 2026 at 10:39 AM GMT, Willem Ferguson wrote: > > Let a sock_ops program pick the identifier that the previous patch > > encodes in the low bits of TSval, for passively opened connections. > > > > The width is set per network namespace by the new tcp_ts_id_bits sysctl > > (0 to 8, default 0). A listener opts in by setting > > BPF_SOCK_OPS_TCP_TS_ID_CB_FLAG, typically from BPF_SOCK_OPS_TCP_LISTEN_CB. > > tcp_conn_request() then runs BPF_SOCK_OPS_TCP_TS_ID_CB once the request > > socket exists and before the SYN-ACK is built, so the SYN-ACK already > > carries the identifier. The program sees the request socket, the SYN > > (bpf_load_hdr_opt() works on it) and the available width in args[1]. A > > reply that fits in that width is stored with the width in the request > > socket and is inherited by the child, including Fast Open children; any > > other reply leaves the connection unencoded. > > > > The callback is not run for SYN cookies, which have nowhere to keep the > > identifier, or when the peer did not negotiate timestamps. It is skipped > > for connections using microsecond timestamps and while the sysctl is 0. > > The width is captured per connection, so changing the sysctl does not > > affect existing connections. > > > > New /proc/net/netstat counters report how often an identifier was > > assigned, declined by the program or skipped. TCPTSIdEchoMismatch counts > > third ACKs whose TSecr no longer carries the identifier, which shows the > > echo was rewritten in flight. > > > > BPF_SOCK_OPS_ALL_CB_FLAGS grows from 0x7f to 0xff. The tcpbpf selftest > > used 0x80 as an example of an unsupported flag, so move it to 0x100. > > > > Encoding makes the timestamp clock appear 2^bits times faster to the > > peer. That shrinks the real-time span of the peer's PAWS window, and > > peers that keep ts_recent for the RFC 7323 24 days stall connections > > idle for longer than 24.8/2^bits days. ip-sysctl.rst documents both, > > along with the lack of TCP_REPAIR support. > > > > Signed-off-by: Willem Ferguson <wferguson@cloudflare.com> > > --- > > I think SOCK_OPS are considered legacy. > We probably want bpf_tcp_ops struct_ops. > See [1] for an example. > > [1] https://lore.kernel.org/all/20261006192601.1875100-11-kuniyu@google.com/ > Exactly! Thanks, Jason
Technical Details
Message-ID:
<CAL+tcoBjfDEVGvvSXZHkiMjq5jat+5OJE-7uJr3MvtFyzn+KUg@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346719-linux-kernel-netdev=dewy.ruReferences:
<20261013103906.2660384-1-wferguson@cloudflare.com> <20261013103906.2660384-3-wferguson@cloudflare.com> <877bjk893u.fsf@cloudflare.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346719-linux-kernel-netdev=dewy.ru
From: kerneljasonxing@gmail.com (Jason Xing)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC PATCH net-next 2/4] tcp: add BPF_SOCK_OPS_TCP_TS_ID_CB to
assign a TSval identifier
Date: Thu, 15 Oct 2026 20:12:39 +0800
Organization: Usenet Network
Message-ID: <CAL+tcoBjfDEVGvvSXZHkiMjq5jat+5OJE-7uJr3MvtFyzn+KUg@mail.gmail.com>
References: <20261013103906.2660384-1-wferguson@cloudflare.com>
<20261013103906.2660384-3-wferguson@cloudflare.com> <877bjk893u.fsf@cloudflare.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="2524860"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3icclM1ER7N+RV2Zg0fAY8PoH0k= sha256:JQOBdqhiafDrbwWb5mcez9EFWeI6Iq3pCqjbTftMka8=
sha1:b5dDM4jyS/YKEte/fbAW9UzVgOQ= sha256:L0Tvjjr9j3UNPTOUlQ5k6NwaSkz9ZD/obTB5cEW3K50=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id AD6901102F0; Thu, 15 Oct 2026 15:13:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id WtyXH7rU3BmR;
Thu, 15 Oct 2026 15:13:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-346719-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 057211102D7; Thu, 15 Oct 2026 15:13:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sin.lore.kernel.org (Postfix) with ESMTP id C219A25119; Thu, 15 Oct 2026 12:13:21 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B1CC51AEFB;
Thu, 15 Oct 2026 12:13:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MFUv0rFw"
X-Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAD3B48C405
for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 12:13:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.167.46
X-ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792066400; cv=pass; b=ayMIRmmZjrBHiqqqdEByf+kmDQUyT0XjuKj8zLvkFv/wFpEenjs2j//HyerR8UEhbm2pf+VJzMiBUomJhHEcTMcHN/fd9Frckt1KAflbYz/k9X8e6qToigyF98rYe++2GH24mMx7atHVk3pXkhFfz0hxmh5uMGjWqKUKcIZNG0k=
X-ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792066400; c=relaxed/simple;
bh=PfWD4VpdWtdSjVgCMYbGy7PflI7LLghvMi+QrsP2eAY=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=UFz2VIZqyReJqr36irVKGaDMDXSWtWL3V9ufCnaTGkpIcqPSh+QXDUsxVb2/ZzuZLblSay1U2CrQvUsAC2b0hvmQZYewiIzTyH/Ptts9GKlNlzPhZw/xbQlA8XPSwFS12Tiz2vG2I+cVLmxxaP5y4zN8p6t6V6VQ7kajshujwQc=
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MFUv0rFw; arc=pass smtp.client-ip=209.85.167.46
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5b8b3c8c4bbso2304963e87.0
for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 05:13:18 -0700 (PDT)
X-ARC-Seal: i=1; a=rsa-sha256; t=1792066397; cv=none;
d=google.com; s=arc-20260327;
b=LPczGlNZ5j3d8YeaspXxaUlU0P1W5b5ImwegnqnwGBgAaro84ZJHZ5ZCpcV6ZPHtDW
90qjnwXz2/KVZR3M/oINte2x+h30k3VD4iXSCsI6Biyw/46x6ssjIns01IcdXj8+q8Im
bj2AUuaiGsc6As/KgK6DX61K9jH3RPjQPHhWRVcgocGcLmddowfHYjrLeZf4hPWZdJ8f
V2KGQ88kiQ7tVO0rHrD7jnfxfPNbSMQIW88rHvETVvxaxrmOmH7O+6+sVn1isQK1VHZv
Y6Z/hNgixGXsu4ipx78tNG/IIuHR9SLZUjBFaFA+8PCTNQa4E9Wh6ws2hInxc4FiUOVK
guzQ==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=PfWD4VpdWtdSjVgCMYbGy7PflI7LLghvMi+QrsP2eAY=;
fh=eu3fNylAgjgul50jhoh2fhz7ga7Bz+ie34HO8yf3GnA=;
b=gzC42sJyAECBmlNFqN/H+CDbD0oUGQ33qm38Kjz4XZtOLpEO97wNWdCglBqJ/Levap
1/EZONQArI+VYsMQfGVInkk8DiDas+JBnVHM94j3MTcjpr9yEIFklShBgVXr40whJUB2
SX2CVAY70j9gWNdOvRwVGf9ZhBviMkYBTrnyJC5GndI59nTKDRoG1ZuPnzuMmMTd8nUM
j701NbVBrMh85NORFK2FPia6EA484a+IoYlkl5pPKAGKT3FCSu+V5OpOqAsNKxbAfZKi
tfWS5kXunsXPmRoMKi/mnI3PTQcEl7gJLdnqM0oSJm1/qCxbJBqBzXs6D7sI1REkPJ6I
s0gQ==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792066397; x=1792671197; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=PfWD4VpdWtdSjVgCMYbGy7PflI7LLghvMi+QrsP2eAY=;
b=MFUv0rFwkY46TMBt7X8wNlMgYfH2YjM20arVDogzgWTSRu/Y6LyM+DTrbXsuUU4IIM
KMefd9j1ptRsfqlo0pBgpWwYnuwS7fgCGXKEckghBS+1MbY5V0k43XFCPQfNBRIo7rqn
7ogA4wk4yI3JLiTiW/wgvj+yXuLzs7al5YO7pu1bm4MGoB+M3Ehh8qJsKATWAJkHuduv
PK7Sw7a+CUJ3u0rQgaaMXwZoRqciyvgFJdV9v6dr96LtRVBOr1510olmTRyInjU3Gj5i
ycB+cHUT0QzW4clXhHZ1Tr619ClxvRi78UB0NIs+BHrDyy9A1FwE0I9Iucm1YJ3qhBiM
Q9vg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792066397; x=1792671197;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=PfWD4VpdWtdSjVgCMYbGy7PflI7LLghvMi+QrsP2eAY=;
b=TOmFw5MIPYOWQPUpghuXAn+W5W22Cb1CJ8PORFubGbG/RnAP6mRC28RTymOOxS2rz2
LfNZbeD9mZ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04-5bcdd4f080cmr6853474e87.10.1792066396625; Thu, 15 Oct 2026
05:13:16 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <877bjk893u.fsf@cloudflare.com>
X-Gm-Features: AclHuK9xypnzrrqwCcprd2CwQO7kzSIQ141D-bgf0CuqS7x-S8jo7RzifyoP-go
X-Cc: Willem Ferguson <wferguson@cloudflare.com>, netdev@vger.kernel.org, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ncardwell@google.com,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, linux-doc@vger.kernel.org,
corbet@lwn.net, linux-kselftest@vger.kernel.org, shuah@kernel.org,
linux-kernel@vger.kernel.org, kernel-team@cloudflare.com