[pkg-ntp-maintainers] Bug#766838: Bug#766838: ntpdate runs before network is up
Kurt Roeckx
kurt at roeckx.be
Sun Jan 15 17:25:29 UTC 2017
On Sun, Jan 15, 2017 at 05:49:51PM +0100, René Wagner wrote:
> 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.
Yes, that would make more sense. I at least have a laptop were
it's not called wlan0.
> 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 don't think we should have a while loop in there, or at least
time out after some time.
But we really shouldn't get called if it's not up in the first place.
And calling us with "--all" doesn't make sense at all.
Kurt
More information about the pkg-ntp-maintainers
mailing list