Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Jason Xing
Thu, 15 Oct 2026 12:12
Re: [RFC PATCH net-next 2/4] tcp: add BPF_SOCK_OPS_TCP_TS_ID_CB to assign a TSval identifier
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads