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)
Tue, Feb 24, 3:59 PM
Unknown Object (File)
Sun, Feb 8, 8:24 AM
Unknown Object (File)
Jan 29 2026, 8:55 AM
Unknown Object (File)
Jan 27 2026, 10:48 PM
Unknown Object (File)
Jan 26 2026, 2:00 AM
Unknown Object (File)
Jan 25 2026, 4:21 AM
Unknown Object (File)
Jan 14 2026, 1:03 PM
Unknown Object (File)
Jan 12 2026, 12:07 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.