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

From: Matthieu Baerts

Date: Tue Nov 17 2026 - 12:37:37 EST


Hello,

On 16/11/2026 03:37, Thaison Phan wrote:
> cookie_tcp_reqsk_alloc() and bpf_sk_assign_tcp_reqsk() allocate struct
> request_sock without __GFP_ZERO, leaving saw_accecn_opt,
> accecn_fail_mode, syn_ect_rcv, and syn_ect_snt uninitialized. When
> accecn_ok is negotiated in cookie_{v4,v6}_check(),
> tcp_ecn_openreq_child() reads all four fields to initialize the child
> socket's AccECN state.
>
> In addition, because the temporary request_sock used to send a cookie
> SYN-ACK is immediately freed, treq->syn_ect_snt is lost. If the listener
> marks ECT (e.g. DCTCP), failing to record syn_ect_snt causes
> tcp_accecn_third_ack() to flag TCP_ACCECN_ACE_FAIL_RECV when the peer
> reflects ECT, disabling ECT for the rest of the connection.
>
> Initialize saw_accecn_opt, accecn_fail_mode, and syn_ect_rcv in
> cookie_tcp_reqsk_init() to match tcp_openreq_init(), and set syn_ect_snt
> from the listener's TOS/tclass in cookie_{v4,v6}_check() to match
> tcp_{v4,v6}_send_synack().

I got a review from Sashiko [1] asking me to fix the same issue, and I
was going to send the same patch. So this v2 looks good to me:

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>

[1] https://lore.kernel.org/sashiko-outbox-213944@xxxxxxxxxx

Cheers,
Matt
--
Sponsored by the NGI0 Core fund.