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, Mar 29, 2:39 PM
Unknown Object (File)
Sat, Mar 28, 11:39 PM
Unknown Object (File)
Mon, Mar 23, 3:49 PM
Unknown Object (File)
Mon, Mar 23, 12:33 AM
Unknown Object (File)
Sat, Mar 21, 12:58 AM
Unknown Object (File)
Fri, Mar 20, 6:06 PM
Unknown Object (File)
Thu, Mar 19, 9:07 PM
Unknown Object (File)
Mon, Mar 16, 1:37 AM

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.