Page MenuHomeFreeBSD

tcp: apply rate limits to challenge ACKs
ClosedPublic

Authored by tuexen on Sep 26 2025, 8:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 29, 8:55 AM
Unknown Object (File)
Tue, Jan 27, 10:48 PM
Unknown Object (File)
Mon, Jan 26, 2:00 AM
Unknown Object (File)
Sun, Jan 25, 4:21 AM
Unknown Object (File)
Wed, Jan 14, 1:03 PM
Unknown Object (File)
Mon, Jan 12, 12:07 PM
Unknown Object (File)
Mon, Jan 12, 11:44 AM
Unknown Object (File)
Sat, Jan 10, 3:35 PM

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/netinet/tcp_syncache.c
1658

I think the two new members of struct syncache shall be initialized around here.

2070–2072

Can remove the else clause by initialize the error first. Like this:

static int
syncache_send_challenge_ack(struct syncache *sc, struct mbuf *m)
{
int error = 0;

if (...) { ... }

return (error);
}

Just my two cents if it is just a coding style.

tuexen added inline comments.
sys/netinet/tcp_syncache.c
1658

I think the two new members of struct syncache shall be initialized around here.

sc is initialized to zero either using uma_zalloc(..., ...| M_ZERO) or by bzero(). So we don't need to explicitly zero fields. Both new fields are therefore initialized to 0 as intended.

2070–2072

Can remove the else clause by initialize the error first. Like this:

static int
syncache_send_challenge_ack(struct syncache *sc, struct mbuf *m)
{
int error = 0;

if (...) { ... }

return (error);
}

Just my two cents if it is just a coding style.

I actually prefer the style I used. I someone adds another branch, the person has to write an explicit initialization of error. If this is forgotten, it is detected by the compiler or a static code analyzer. If you unconditionally initialize it to 0, this bug is not catched (assuming you want a non-zero error value).
But I am flexible on this, since this is a style question.

This revision is now accepted and ready to land.Sep 30 2025, 5:57 PM
This revision was automatically updated to reflect the committed changes.
tuexen marked 2 inline comments as done.