Skip to content

Commit

Permalink
Add ACE check on first data ACK
Browse files Browse the repository at this point in the history
  • Loading branch information
minuscat committed Feb 3, 2024
1 parent bde09fe commit 5d809aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/linux/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ struct tcp_sock {
syn_ect_rcv:2, /* ... needed durign 3WHS + first seqno */
ecn_fail:1; /* ECN reflector detected path mangling */
u8 accecn_no_respond:1, /* AccECN no response on feedback */
accecn_no_options:1; /* AccECN no options send out */
accecn_no_options:1, /* AccECN no options send out */
first_data_ack:1; /* Check for first data ack */
u8 saw_accecn_opt:2, /* An AccECN option was seen */
fast_ack_mode:2, /* which fast ack mode ? */
unused:4;
Expand Down
1 change: 1 addition & 0 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tp->ecn_fail = 0;
tp->accecn_no_respond = 0;
tp->accecn_no_options = 0;
tp->first_data_ack = 0;
tcp_accecn_init_counters(tp);
tp->prev_ecnfield = 0;
tp->accecn_opt_tstamp = 0;
Expand Down
15 changes: 15 additions & 0 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,21 @@ static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb,
if (flag & FLAG_SYN_ACKED)
return 0;

/* [CY] 3.2.2.4. Testing for Zeroing of the ACE Field - If AccECN has been successfully negotiated, the Data Sender
* MAY check the value of the ACE counter in the first feedback packet (with or without data) that arrives after the
* 3-way handshake. If the value of this ACE field is found to be zero (0b000), for the remainder of the half-
* connection the Data Sender ought to send non-ECN-capable packets and it is advised not to respond to any feedback
* of CE markings.
*/
if (!tp->first_data_ack) {
tp->first_data_ack = 1;
if (!tcp_accecn_ace(tcp_hdr(skb))) {
tp->ecn_fail = 1;
tp->accecn_no_respond = 1;
return 0;
}
}

if (tp->received_ce_pending >= TCP_ACCECN_ACE_MAX_DELTA)
inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_minisocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static void tcp_ecn_openreq_child(struct sock *sk,
const struct tcp_request_sock *treq = tcp_rsk(req);
struct tcp_sock *tp = tcp_sk(sk);

/* [CY] 3.1.5. Implications of AccECN Mode - A TCP Server in AccECN mode: MUST NOT set ECT oni
/* [CY] 3.1.5. Implications of AccECN Mode - A TCP Server in AccECN mode: MUST NOT set ECT on
* any packet for the rest of the connection, if it has received or sent at least one valid
* SYN or Acceptable SYN/ACK with (AE,CWR,ECE) = (0,0,0) during the handshake.
*/
Expand Down

0 comments on commit 5d809aa

Please sign in to comment.