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)
Sun, Nov 9, 3:08 AM
Unknown Object (File)
Sun, Nov 2, 7:11 AM
Unknown Object (File)
Sat, Nov 1, 4:42 AM
Unknown Object (File)
Wed, Oct 29, 4:53 PM
Unknown Object (File)
Wed, Oct 29, 2:06 PM
Unknown Object (File)
Wed, Oct 29, 12:53 PM
Unknown Object (File)
Wed, Oct 29, 12:52 PM
Unknown Object (File)
Sun, Oct 26, 11:54 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.