[Bug 1295229] Re: With 'hosts: mdns4' in nsswitch.conf, getaddrinfo() returns -5 (EAI_NODATA) when network interface is down
Trent Lloyd
trent.lloyd at canonical.com
Fri Nov 17 00:28:38 UTC 2017
Did a quick test with the originally attached test file, this only
happens if 'mdns4' is last on the nsswitch.conf line. I don't think
this is the default we ship anymore, we currently ship:
hosts: files mdns4_minimal [NOTFOUND=return] dns
TJ: Do you have the exact nsswitch.conf line the user was using?
With regards to the multi second timeouts.. this should only happen if the user is looking up a .local hostname or reverse DNS specifically for 169.254.x.x.. I'd also wonder if they had a interface with a 169.254 link-local address assigned. Do you also happen to have the output of "ip addr" and "ip -6 addr"
Alternative I am lathiat on IRC, maybe you can put me in contact with
the user?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to nss-mdns in Ubuntu.
https://bugs.launchpad.net/bugs/1295229
Title:
With 'hosts: mdns4' in nsswitch.conf, getaddrinfo() returns -5
(EAI_NODATA) when network interface is down
Status in nss-mdns package in Ubuntu:
Confirmed
Bug description:
When the "hosts:" line in nsswitch.conf includes `mdns4` or
`mdns4_minimal` last and the network interface is taken down,
getaddrinfo() returns -5 (EAI_NODATA — "No address associated with
hostname") instead of something more appropriate such as -4 (EAI_FAIL
— "Non-recoverable failure in name resolution").
$ dpkg -l libc6
[...]
ii libc6:amd64 2.17-93ubuntu4 amd64
$ grep hosts /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
$ sudo su
# ifconfig eth0 down
# ./a.out
Making resolv.conf empty
Results of looking up www.google.com: status = -5, errno = 110
Results of looking up a bogus name: status = -5, errno = 110
Writing correct nameserver option to resolv.conf
Results of looking up www.google.com: status = -5, errno = 110
Results of looking up a bogus name: status = -5, errno = 110
Writing incorrect nameserver option to resolv.conf
Results of looking up www.google.com: status = -5, errno = 110
Results of looking up a bogus name: status = -5, errno = 110
# cat x.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
struct addrinfo *res;
void check_google()
{
int status;
status = getaddrinfo("www.google.com", NULL, NULL, &res);
printf("Results of looking up www.google.com: status = %d, errno = %d\n", status, errno);
status = getaddrinfo("sjfkdsjfswfloo0f02938sjf28398sd.com", NULL, NULL, &res);
printf("Results of looking up a bogus name: status = %d, errno = %d\n", status, errno);
}
int main()
{
FILE *fp;
printf("Making resolv.conf empty\n");
fp = fopen("/etc/resolv.conf", "w+"); fclose(fp);
sleep(1);
check_google();
printf("Writing nameserver option to resolv.conf\n");
fp = fopen("/etc/resolv.conf", "w+"); fprintf(fp, "nameserver 193.67.79.39\n"); fclose(fp);
sleep(1);
check_google();
printf("Writing incorrect nameserver option to resolv.conf\n");
fp = fopen("/etc/resolv.conf", "w+"); fprintf(fp, "nameserver 192.168.5.4\n"); fclose(fp);
sleep(1);
check_google();
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nss-mdns/+bug/1295229/+subscriptions
More information about the foundations-bugs
mailing list