Resolution differences for getaddrinfo versus host/dig/delv

Tony Finch dot at
Wed Nov 18 14:21:23 UTC 2015

Phil Mayers <p.mayers at> wrote:
> This hostname is resolvable using "dig" & "host", but on Linux (glibc 2.20)
> the "ping", "telnet" and "nc" commands return "unknown host" or equivalent.

`ping` fails for me on FreeBSD but not MacOS.

> I suspect getaddrinfo isn't parsing the DNS response for some reason.

Well, sort of. The failure is because the resolver is doing name validity
checks along the chain of aliases, and an intermediate wildcard is not a
valid hostname.

For instance, have a look at

Note the name_ok function pointer which is set to res_hnok for forward
queries, and res_hnok checks LDH syntax (plus underscores).

The old libbind code is similar, as is glibc.

f.anthony.n.finch  <dot at>
Fair Isle, South Faeroes: Cyclonic 4 or 5, occasionally 6, becoming
northeasterly 5 to 7, increasing gale 8 for a time. Rough or very rough,
occasionally moderate. Rain or showers. Moderate or good.

More information about the bind-users mailing list