Re: [PATCH net v2 2/2] tcp: accecn: initialize AccECN fields in syncookie path

From: Thaison Phan

Date: Wed Nov 18 2026 - 15:15:57 EST


On Wed, Nov 18, 2026 at 10:30:58AM +0100, Eric Dumazet wrote:
> Sashiko has a point about the BPF custom syncookie case.
>
> Requests coming from cookie_bpf_check() also reach this line, but the
> kernel did not send that SYN-ACK, a TC/XDP program did. The listener's
> tos/tclass says nothing about the ECN codepoint the program used, and
> struct bpf_tcp_req_attrs has no way to report it.
[...]
> Could you send a v3 doing something like this (untested)?
>
> In cookie_tcp_reqsk_init():
>
> treq->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN;
> treq->accecn_fail_mode = 0;
> treq->syn_ect_rcv = 0;
> treq->syn_ect_snt = 0;
>
> In cookie_v4_check():
>
> /* SYN-ACK was not sent by the kernel if req->syncookie is set. */
> if (!req->syncookie)
> treq->syn_ect_snt = READ_ONCE(inet_sk(sk)->tos) & INET_ECN_MASK;
>
> And the same in cookie_v6_check() with np->tclass.
>
> Letting the BPF program report the codepoint it used (a new field in
> struct bpf_tcp_req_attrs) would be net-next material.
>
> The other Sashiko remark (AccECN option carried by the third ACK is not
> processed in the syncookie path, unlike tcp_check_req()) looks correct,
> but this is not something added by this patch. It can be handled
> separately, no need to grow this series.
>
> Please mention the BPF case in the changelog. You can keep the
> Reviewed-by tags on both patches.

Makes sense, thanks for catching that and suggesting the fix. Since v3 [1]
already went out yesterday for Chia-Yu's changelog clarification, I'll fold
the !req->syncookie check, restore treq->syn_ect_snt = 0, and note the BPF
custom syncookie behavior in v4.

I think the Sashiko remark on the (AccEcn Option carried by the third ACK) is
correct as well, but I agree we can fix that in a separate patch set as it
isn't directly related to uninitialized fields.

[1] https://lore.kernel.org/netdev/20261117124710.1338951-1-thaisonphan@xxxxxxxxxx/