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
F156854149: D55661.id173156.diff
Sat, May 16, 10:26 PM
F156853154: D55661.id173156.diff
Sat, May 16, 10:18 PM
Unknown Object (File)
Fri, May 15, 3:15 PM
Unknown Object (File)
Mon, May 11, 10:10 PM
Unknown Object (File)
Sun, May 10, 2:07 PM
Unknown Object (File)
Sun, May 10, 2:02 PM
Unknown Object (File)
Sun, May 10, 3:15 AM
Unknown Object (File)
Sun, May 10, 3:09 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 71550
Build 68433: arc lint + arc unit

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
515–516

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
1430

style

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

+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