[LEDE-DEV] [RFC] sysntpd: restore support for peer-less (standalone) mode

Piotr Dymacz pepe2k at gmail.com
Wed Mar 8 16:11:32 PST 2017


Hello Philip,

On 09.03.2017 00:40, Philip Prindeville wrote:
>
>> On Mar 6, 2017, at 3:20 PM, Piotr Dymacz <pepe2k at gmail.com> wrote:
>>
>> ntpd from Busybox supports peer-less (standalone) mode when it's
>> started with option -l and without any peer provided with option
>> -p. In this mode ntpd uses local time as reference and acts as
>> stratum 1 server.
>>
>> This mode can be used in isolated networks, where Internet access
>> and/or other NTP server/s are not available, but the device has
>> some other way of getting correct time, like e.g. GPS (ugps
>> supports setting local time by default).
>
>
> It’s not enough to have your clock set to the correct time initially:
> you also need to assure the accuracy of your clock as time goes by,
> i.e. ensuring that it’s not running too fast or head or too slow
> behind.

Fully agree.

> All clocks will have some inherent inaccuracy (due to thermal noise,
> age, inconsistent power, etc).  But comparing them regularly to other
> clocks (i.e. peers or servers) allows you to understand how your own
> clock is behaving and to adjust it (i.e. “discipline it”)
> accordingly.

Agree.

> I don’t think that lying about the accuracy of your clock by
> declaring it stratum 1 is a good thing.
>
> At least “fudge” the local clock and downgrade its stratum (however
> busybox does that).

This is only an optional, already included "feature" of Busybox ntpd 
applet (if it's built with support for server mode/-l option which is 
true in our case), which was just disabled in our sysntpd init script, 
probably by a mistake. Related Busybox change is here: [1].

By default, we use ntpd in client-only mode, with our upstream servers 
listed with -p option.

As far as I can see in code [2], there is no way to change default 
stratum value for for this "standalone" mode, but it was discussed on 
Busybox mailing list: [3].

[1] 
https://git.busybox.net/busybox/commit/?id=d678257c26e0993efc48ac4433d153e1e9dfc954

[2] https://git.busybox.net/busybox/tree/networking/ntpd.c?h=1_26_stable

[3] http://lists.busybox.net/pipermail/busybox/2010-October/073518.html

--
Cheers,
Piotr

>>
>> Support for this mode was incorrectly disabled/removed in:
>> 1527f96ca6e196fa17c96fdb3ae520158fa5943f
>>
>> Signed-off-by: Piotr Dymacz <pepe2k at gmail.com> ---
>> package/utils/busybox/files/sysntpd | 2 +- 1 file changed, 1
>> insertion(+), 1 deletion(-)
>>
>> diff --git a/package/utils/busybox/files/sysntpd
>> b/package/utils/busybox/files/sysntpd index 98260be..e693e40
>> 100755 --- a/package/utils/busybox/files/sysntpd +++
>> b/package/utils/busybox/files/sysntpd @@ -45,7 +45,7 @@
>> start_service() {
>>
>> [ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
>>
>> -	[ -z "$server" ] && return +	[ -z "$server" -a "$enable_server" =
>> "0" ] && return
>>
>> procd_open_instance procd_set_param command "$PROG" -n -N -- 2.7.4
>>
>>
>> _______________________________________________ Lede-dev mailing
>> list Lede-dev at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
>




More information about the Lede-dev mailing list