Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2015 00:49:58 +0200
From:      Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
To:        freebsd-mips@freebsd.org
Cc:        glebius@FreeBSD.org
Subject:   Re: Edge Router Lite: ntpd/ntpdate switch to 2050
Message-ID:  <20150421224958.GA13041@lyxys.ka.sub.org>
In-Reply-To: <m24mob1um2.fsf@gmail.com>
References:  <20150413130309.GA82425@lyxys.ka.sub.org> <m24mob1um2.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[Cc Gleb because he committed the current ntp/config.h]

* Anmol Khirbat <khirbat@gmail.com> [150420 03:00]:
> Wolfgang Zenker <wolfgang@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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150421224958.GA13041>