Page MenuHomeFreeBSD

ping6: treat setsockopt failures as fatal
ClosedPublic

Authored by chris.longros_gmail.com on Apr 3 2026, 3:13 PM.
Tags
None
Referenced Files
F156521751: D56237.id175774.diff
Thu, May 14, 9:26 AM
F156514191: D56237.id174861.diff
Thu, May 14, 7:43 AM
Unknown Object (File)
Wed, May 13, 4:32 PM
Unknown Object (File)
Mon, May 11, 1:48 PM
Unknown Object (File)
Sat, May 9, 8:56 PM
Unknown Object (File)
Sat, May 2, 1:28 PM
Unknown Object (File)
Tue, Apr 28, 12:25 AM
Unknown Object (File)
Thu, Apr 23, 4:59 PM
Subscribers

Details

Summary

ping6 needs IPV6_RECVPKTINFO and IPV6_RECVHOPLIMIT to process
incoming replies. When these options fail, replies are silently
dropped and ping6 appears to hang. Use err(3) instead of warn(3)
so the user gets a clear error and immediate exit.

Signed-off-by: Christos Longros <chris.longros@gmail.com>

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.Apr 7 2026, 11:51 AM

@jlduran Hi, this has been accepted — could you commit it? Thanks!

Yes, this should be pretty straightforward.
I added the network project, just in case. Let's wait one more week, plus an MFC of one week after that.
If this is time-sensitive, let me know and I will commit sooner. Thank you!

pouria added a subscriber: pouria.

LGTM, but I can't test it because almost all of those values are validated before reaching those lines.
I would appreciate it if you could provide steps to reproduce.

glebius added a subscriber: glebius.

I don't think it is possible to reproduce that. The program always passes correct optval to a correct socket. The flag enabling setsockopt() shall never fail in the kernel. Treat that more as a stylistic change. It might be useful for FreeBSD-derived projects, e.g. if Mac OS X refreshes their ping(1) with our ping, as they already did in the past, and their kernel may fail at these setsockopts.

This revision was automatically updated to reflect the committed changes.