The NTP distribution supplied by nwtime.org and used in the FreeBSD ports collection makes use of SO_BINTIME on FreeBSD. SO_BINTIME appears broken for IPv6 on FreeBSD 14.3, and earlier versions. [getsockopt confirms that SO_BINTIME is set]. The IPv6 socket also has SO_IPV6ONLY set, if that matters. An IPv4 socket provides SCM_BINTIME, an IPv6 socket does not (msghdr is NULL). It would help to know the expected disposition of this issue.
Just for completeness, this is related to the bug report https://bugs.ntp.org/show_bug.cgi?id=3989 at ntp.org. Also see the e-mail "IPv6 and SO_BINTIME" from Harlan Stenn in freebsd-net mailing list at https://lists.freebsd.org/archives/freebsd-net/2025-September/007416.html Hopefully anybody is able in taking this for further discussion. PS: I am only involved as Steve has contacted me because he does measurements of NTP Pool servers and some of mine did show some odd behavior and I provided details about the system, software and also a tcpdump ntp traffic capture.
Indeed, as far as I can tell we simply don't implement SO_BINTIME for v6: udp_append() handles it, while udp6_append() does not. Both implement SO_TIMESTAMP though.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=cd02a8a9f8be2085d5242606a79668dc3720e7b0 commit cd02a8a9f8be2085d5242606a79668dc3720e7b0 Author: Jonathan T. Looney <jtl@FreeBSD.org> AuthorDate: 2025-09-12 17:49:17 +0000 Commit: Jonathan T. Looney <jtl@FreeBSD.org> CommitDate: 2025-09-15 16:46:03 +0000 ip6: add SO_BINTIME support This adds support for obtaining timestamps from IPv6 packets using the SO_BINTIME socket option, bringing it in parity with IPv4 behavior. Enable testing the SO_BINTIME option in the relevant (manual) regression test. PR: 289423 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52504 sys/netinet6/ip6_input.c | 53 +++++++++++++++------- .../regression/sockets/udp_pingpong/udp_pingpong.c | 8 ++-- 2 files changed, 39 insertions(+), 22 deletions(-)
I committed a fix to main. I will close the bug once it is MFCd. In the meantime, feel free to test with -CURRENT.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5b59ff1e160727c80686bbfc728dae075fcd0d4f commit 5b59ff1e160727c80686bbfc728dae075fcd0d4f Author: Jonathan T. Looney <jtl@FreeBSD.org> AuthorDate: 2025-09-12 17:49:17 +0000 Commit: Jonathan T. Looney <jtl@FreeBSD.org> CommitDate: 2025-09-29 15:03:02 +0000 ip6: add SO_BINTIME support This adds support for obtaining timestamps from IPv6 packets using the SO_BINTIME socket option, bringing it in parity with IPv4 behavior. Enable testing the SO_BINTIME option in the relevant (manual) regression test. PR: 289423 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52504 (cherry picked from commit cd02a8a9f8be2085d5242606a79668dc3720e7b0) sys/netinet6/ip6_input.c | 53 +++++++++++++++------- .../regression/sockets/udp_pingpong/udp_pingpong.c | 8 ++-- 2 files changed, 39 insertions(+), 22 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f801346706ea75401614df2dba3f85ecea2af03e commit f801346706ea75401614df2dba3f85ecea2af03e Author: Jonathan T. Looney <jtl@FreeBSD.org> AuthorDate: 2025-09-12 17:49:17 +0000 Commit: Jonathan T. Looney <jtl@FreeBSD.org> CommitDate: 2025-09-29 15:12:49 +0000 ip6: add SO_BINTIME support This adds support for obtaining timestamps from IPv6 packets using the SO_BINTIME socket option, bringing it in parity with IPv4 behavior. Enable testing the SO_BINTIME option in the relevant (manual) regression test. PR: 289423 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52504 (cherry picked from commit cd02a8a9f8be2085d5242606a79668dc3720e7b0) sys/netinet6/ip6_input.c | 53 +++++++++++++++------- .../regression/sockets/udp_pingpong/udp_pingpong.c | 8 ++-- 2 files changed, 39 insertions(+), 22 deletions(-)
Thank you for adding SO_BINTIME support to FreeBSD's IPv6. In order to better support FreeBSD before this fix, it seems like it would be nice to change ntpd to use SO_TS_CLOCK and SO_TS_BINTIME in preference to SO_BINTIME on systems which support it, as it seems like FreeBSD IPv6 has had this similarly higher-precision UDP arrival timestamping support in IPv6 for years. This is mentioned in https://bugs.ntp.org/show_bug.cgi?id=3989#c1