[pkg-ntp-maintainers] Bug#766838: ntpdate runs before network is up
René Wagner
rw at nelianur.org
Sun Jan 15 16:49:51 UTC 2017
tags 766838 + patch
thanks
Dear maintainers,
my testing indicates that there are two distinct problems. First, for
whatever reason, /etc/network/if-up.d/ntpdate is called with $IFACE =
--all in addition to legitimate interfaces. This causes a race
condition: If the $IFACE = --all instance wins, the other instances are
prevented from doing anything useful.
Secondly, /etc/network/if-up.d/ntpdate is called somewhat early, i.e.
when the interface is already up but before an IP address has been
obtained via DHCP.
The attached patch fixes both issues for me. It contains a whitelist of
interfaces /etc/network/if-up.d/ntpdate should act upon (eth*, wlan*) to
avoid the bogus $IFACE = --all case. In hindsight, perhaps this should
be turned into a blacklist containing "--all" only.
The second part of the patch builds upon Hartmut Buhrmester's suggestion
to insert a "sleep" call, but parses ifconfig output until an IP address
has been assigned. This part handles the IPv4 case only since I don't
have an IPv6 network to test with.
I hope you'll find the patch useful!
Cheers,
Rene
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etc-network-if-up.d-ntpdate.diff
Type: text/x-patch
Size: 779 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-ntp-maintainers/attachments/20170115/5271562e/attachment.bin>
More information about the pkg-ntp-maintainers
mailing list