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, Jun 2, 9:41 PM
Unknown Object (File)
Sat, May 30, 10:50 PM
Unknown Object (File)
Thu, May 28, 10:51 PM
Unknown Object (File)
Wed, May 27, 12:08 PM
Unknown Object (File)
Tue, May 26, 2:19 AM
Unknown Object (File)
Fri, May 22, 2:25 AM
Unknown Object (File)
Thu, May 21, 5:42 PM
Unknown Object (File)
Fri, May 15, 12:58 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.