Skip to content

Commit

Permalink
Fix multiple RST causing cooldown to multiple more than once
Browse files Browse the repository at this point in the history
When state is idle, conn->initiator is undefined (actually the last connection's value), so we rule it out.
  • Loading branch information
hack3ric committed Dec 4, 2024
1 parent 27ccf4d commit 63a9242
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,14 @@ static __always_inline struct connection conn_init(struct filter_settings* setti
}

static __always_inline void conn_reset(struct connection* conn, __u64 tstamp) {
if (conn->initiator && conn->state != CONN_IDLE && conn->cooldown_mul < 11)
conn->cooldown_mul += 1;
conn->state = CONN_IDLE;
conn->seq = conn->ack_seq = 0;
// conn->pktbuf should be swapped out prior
conn->cwnd = INIT_CWND;
conn->peer_mss = 0;
conn->keepalive_sent = false;
if (conn->initiator && conn->cooldown_mul < 11) conn->cooldown_mul += 1;
conn->retry_tstamp = conn->reset_tstamp = conn->stale_tstamp = tstamp;
}

Expand Down

0 comments on commit 63a9242

Please sign in to comment.