[ntp:questions] nptq -p slowness
mayer at ntp.isc.org
Sat Feb 3 06:02:56 UTC 2007
Ronan Flood wrote:
> mayer at ntp.isc.org (Danny Mayer) wrote:
>> What the code DOES do and should not do is the following:
>> a) try and convert the refid into an intenet name for the address, ie a
>> DNS lookup;
>> b) if that fails and the length of the refid data is <= 4 assume it's a
>> refclock code (like GPS) and surrounds it with dots.
>> It's a) which causes the problem and is completely unnecessary.
> But a) shouldn't do that: decodenetnum() calling getaddrinfo() with
> AI_NUMERICHOST is effectively just a check that it is a syntactically
> valid IP address -- there should be no DNS lookups generated.
> The original query seems to have come from someone with a broken OS,
> or perhaps using a different version of ntpq.
Right, but the code is ordered incorrectly in the first place. First
test to see if the string is <= 4 and if so don't bother with a
decodenetnum() call. A refid as an IPv4 address is always at least 7
characters so you can skip the step if it doesn't have enough
characters. I just fixed this code too.
More information about the questions