Re: [PATCH net v3 2/2] tcp: accecn: initialize AccECN fields in syncookie path
From: Matthieu Baerts
Date: Tue Nov 17 2026 - 13:07:10 EST
Hi Thaison,
On 17/11/2026 13:47, 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. For AccECN
> connections where the listener marks ECT on the SYN-ACK, leaving
> syn_ect_snt as 0 causes tcp_accecn_third_ack() to see a mismatch between
> the expected Not-ECT and the peer's reflected ECT in the ACE field,
> erroneously flagging TCP_ACCECN_ACE_FAIL_RECV in accecn_fail_mode. Refer
> to Table 4 of RFC 9768 for more details.
>
> 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 missed the v3:
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.