Edge Router Lite: ntpd/ntpdate switch to 2050

Wolfgang Zenker wolfgang at lyxys.ka.sub.org
Tue Apr 21 22:45:07 UTC 2015


[Cc Gleb because he committed the current ntp/config.h]

* Anmol Khirbat <khirbat at gmail.com> [150420 03:00]:
> Wolfgang Zenker <wolfgang at lyxys.ka.sub.org> writes:
>> not sure if this is platform related or a generic problem: After the
>> recent ntpd update my Edge Router Lite running current has the problem
>> that ntpd and ntpdate set the date/time to somewhere in 2050, but only
>> if the offset of the system clock is larger than about 0.5 seconds.

>> Currently running:
>> FreeBSD pomona 11.0-CURRENT FreeBSD 11.0-CURRENT #0: Mon Apr 13 03:48:04 CEST 2015     wolfgang at pomona:/usr/obj/usr/src/sys/UBQTERL  mips

>> Problem happened with a few earlier versions after the new ntpd as well.

> I think this is a problem on all big-endian systems.  I tried mips,
> mips64 and powerpc64 using Qemu.
> [..]
> Looks like usr.sbin/ntp/config.h is wrong.  This seems to fix ntpdate.
> I am not sure what a general fix for all possible architectures would look like.

> diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h
> index b771834..a6ed749 100644
> --- a/usr.sbin/ntp/config.h
> +++ b/usr.sbin/ntp/config.h
> @@ -1586,7 +1586,7 @@ typedef unsigned int      uintptr_t;
>  # endif
>  #else
>  # ifndef WORDS_BIGENDIAN
> -/* #  undef WORDS_BIGENDIAN */
> +#  define WORDS_BIGENDIAN 1
>  # endif
>  #endif

I agree, running the configure script in /usr/src/contrib/ntp on a big-endian
system produces a config.h that has the "#  define WORDS_BIGENDIAN 1" line.
Probably everyone expected the ntp sources to use the proper macros to
convert between "network" and "host" byte order, in that case the ntp
sources would not need to know about the endian-ness. But apparently that
is not the case, so our pre-defined /usr/src/usr.sbin/ntp/config.h needs
to have a mechanism to set WORDS_BIGENDIAN depending on the platform.

Wolfgang


More information about the freebsd-mips mailing list