[ntp:questions] NTP Daemon Stuck in Resolver Jail When Run from Connman
marathon96 at gmail.com
Wed Apr 27 01:27:24 UTC 2011
On Apr 26, 2011, at 6:18 PM, Marcel Holtmann wrote:
>>>>>> I've been experimenting recently, in version 0.71, with connman's ability
>>>>>> launch the NTP daemon in one-shot mode when the service state transitions
>>>>>> online mode.
>>>>>> However, what I notice in practice is that when the time server is any
>>>>>> entity (e.g. time.ubuntu.org or pool.ntp.org), the NTP daemon fails to
>>>>>> resolve the name, ntpd_intres gets forked and launched and then
>>>>>> fails to resolve the name.
>>>> At this point, my next step may be to try calling the connman
>>>> g_resolve_lookup_hostname while building the temporary configuration peer
>>> Try to have ConnMan resolve the name before calling the ntpd one-shot
>>> command line and give the IP address to that one. I am curious if that
>>> would work.
>> As suggested above, if I set up a new gresolv instance and call
>> g_resolv_lookup_hostname from ntpdate_add_peer, it works consistently (see
>> output below). Would you like a patch for this?
> as a short term solution, I am fine with trying to resolve the IP
> address before calling ntpd. Just keep in mind that you need to check if
> the server name might be already an IP address.
I didn't bother special casing this as it just worked. The resolver simply returns immediately with the IP address and I add it to the peer file.
> In case of DHCP it is possible that it hands out IP addresses directly.
Confirmed. I tested exactly that case.
> The only small downside I see is that normally pool.ntp.org is round
> robin DNS server and hands out more than one address. However since we
> do one shot only anyway, just picking the first address should be fine.
The current implementation takes all the results; however, it should be trivial to modify to just take the first result.
> That all said, I am still curious what happens with ntpd and name
> resolving that this causes so many problems.
I am as well; however, having spent several days on this I am ready to move on. I've CC'd the NTP questions list on this thread in the event they have some insights or experimental suggestions.
Thanks for being a sounding board on this.
More information about the questions