Subject: | AnyEvent::DNS parses nameserver lines too strictly |
AnyEvent::DNS's parsing of nameserver lines in /etc/resolv.conf is
stricter than glibc's. In my environment the generation process adds
the hostname as a "comment":
nameserver 1.2.3.4 ; foo
I'm not sure if this is documented anywhere as supported, but it works
because glibc (in res_init) will take everything after
the "nameserver " and pass it to inet_aton; inet_aton happily ignores
anything after the address, so inet_aton("1.2.3.4 ; foo") returns the
properly packed address.
The specific workaround for this is probably to relax this regex in
AnyEvent/DNS.pm:
old: if (/^\s*nameserver\s+(\S+)\s*$/i) {
new: if (/^\s*nameserver\s+(\S+)/i) {
Also, glibc recognizes ";" as a valid comment character, in addition
to "#", so another option would be to do the same:
old: s/#.*$//; # not quite legal, but many people insist
new: s/[#;].*$//; # not quite legal, but many people insist