Page MenuHomeFreeBSD

ping6: treat setsockopt failures as fatal
ClosedPublic

Authored by chris.longros_gmail.com on Fri, Apr 3, 3:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 18, 2:12 PM
Unknown Object (File)
Sat, Apr 18, 8:33 AM
Unknown Object (File)
Sat, Apr 18, 8:10 AM
Unknown Object (File)
Sat, Apr 18, 6:16 AM
Unknown Object (File)
Fri, Apr 17, 9:45 PM
Unknown Object (File)
Fri, Apr 17, 1:22 PM
Unknown Object (File)
Tue, Apr 14, 6:25 AM
Unknown Object (File)
Sat, Apr 11, 11:41 AM
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 Passed
Unit
No Test Coverage
Build Status
Buildable 71938
Build 68821: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Tue, Apr 7, 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.