Page MenuHomeFreeBSD

raw ip: clear sin_port on bind(2)
ClosedPublic

Authored by glebius on Sep 10 2026, 2:03 PM.
Tags
None
Referenced Files
F175360361: D59570.id186510.diff
Sat, Oct 10, 7:01 AM
Unknown Object (File)
Fri, Oct 9, 5:15 AM
Unknown Object (File)
Tue, Oct 6, 7:46 AM
Unknown Object (File)
Mon, Oct 5, 3:56 AM
Unknown Object (File)
Sun, Oct 4, 1:36 PM
Unknown Object (File)
Sat, Oct 3, 8:58 PM
Unknown Object (File)
Sat, Oct 3, 8:58 PM
Unknown Object (File)
Sat, Oct 3, 12:29 AM
Subscribers

Details

Summary

Application may set sin_port to some value. Although this value is not
used by SOCK_RAW, it breaks a check that the address is available. A
perfect fix would be not use sockaddrs for ifaddrs, but that would be a
bigger change.

PR: 298366
Fixes: 948ad32ae1e0811f45e1d38f26636fefed5051f0

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Sep 10 2026, 2:27 PM

What if the application set the sin6_flowinfo too?

What if the application set the sin6_flowinfo too?

Good question. Probably same bug? We just didn't encounter application that sets it.

This change is good by nature. but it would be nice to have a comment above sa_equal in case we forget the original issue

This revision was automatically updated to reflect the committed changes.