Page MenuHomeFreeBSD

inpcb: apply smr_advance(9)/smr_wait(9) trick only to reusable sockets
ClosedPublic

Authored by glebius on Mar 4 2026, 9:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 18, 12:36 PM
Unknown Object (File)
Sat, Apr 18, 9:49 AM
Unknown Object (File)
Sat, Apr 18, 9:49 AM
Unknown Object (File)
Sat, Apr 18, 7:52 AM
Unknown Object (File)
Sat, Apr 18, 7:51 AM
Unknown Object (File)
Tue, Apr 14, 2:12 AM
Unknown Object (File)
Sat, Apr 11, 12:48 PM
Unknown Object (File)
Sat, Apr 11, 12:41 PM
Subscribers

Details

Summary

The protocols marked with PR_CONNREQUIRED can never go through pr_connect
after being disconnected. This is a tiny improvement of fdb987bebddf0.

Diff Detail

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

Event Timeline

This removes the smr_advance() calls, but also the clearing of the addr/port. Is it intentional?

I don't see a point in clearing the addresses either. Speculatively (didn't check!) it should even fix getsockname(2) on a disconnected TCP connection.

I don't see a point in clearing the addresses either. Speculatively (didn't check!) it should even fix getsockname(2) on a disconnected TCP connection.

I don't see much point either, but the code has done this since at least 1994. But ok, I think this change is functionally a no-op anyway, since only the UDP code uses these functions...?

sys/netinet6/in6_pcb.c
512–513

This comment applies to the smr_advance() call, so should be moved to make that more clear. Same thing above.

Adjust comment placement per Mark's suggestion.

I'll write a manual for in_pcb someday...

sys/netinet/in_pcb.c
1436–1442

style

sys/netinet6/in6_pcb.c
513–520
This revision is now accepted and ready to land.Mar 19 2026, 9:57 PM
markj added inline comments.
sys/netinet/in_pcb.c
1436–1442

+1

This revision now requires review to proceed.Mar 20 2026, 8:27 PM

I don't see a point in clearing the addresses either. Speculatively (didn't check!) it should even fix getsockname(2) on a disconnected TCP connection.

I don't see much point either, but the code has done this since at least 1994. But ok, I think this change is functionally a no-op anyway, since only the UDP code uses these functions...?

The commit log message should mention this aspect of the change.

This revision is now accepted and ready to land.Mar 21 2026, 2:07 AM