Bug 460561 - getaddrinfo() returns EAI_NONAME instead of EAI_AGAIN
getaddrinfo() returns EAI_NONAME instead of EAI_AGAIN
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Andreas Schwab
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-08-28 12:39 EDT by Miroslav Lichvar
Modified: 2009-10-28 11:54 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-10-28 11:54:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Miroslav Lichvar 2008-08-28 12:39:08 EDT
Description of problem:
In default configuration, when resolv.conf is empty, getaddrinfo() returns EAI_NONAME instead of EAI_AGAIN (as it used to in F9).

This makes ntpd useless when NetworkManager is enabled, because ntpd won't try to resolve the name later when NM has setup resolv.conf.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. > /etc/resolv.conf
2. gcc -x c - <<EOF
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>

int main() {
	struct addrinfo hints, *addr;

	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_UNSPEC;

	printf("%d\n", getaddrinfo("0.fedora.pool.ntp.org", NULL, &hints, &addr));
	return 0;
3. ./a.out
Actual results:

Expected results:

Additional info:
Comment 1 Miroslav Lichvar 2008-10-06 06:24:47 EDT
Any chance this will be resolved in F10? I can put a workaround to ntpd if necessary, but ntpd in default installation with default config doesn't work now.
Comment 2 Mads Kiilerich 2008-11-13 14:09:09 EST
I have created Bug 471450 which might be related
Comment 3 Bug Zapper 2008-11-25 21:53:47 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
Comment 4 Tim Waugh 2008-11-27 05:02:57 EST
Also related: cups-polld fails to resolve hostnames, even though it calls res_init() if it gets EAI_FAIL from getaddrinfo().  This is because getaddrinfo() is caching EAI_NONAME results.
Comment 5 Ulrich Drepper 2008-12-03 02:12:21 EST
I've changed the upstream glibc code.
Comment 6 lexual 2009-03-03 20:04:02 EST
Has this upstream code hit f9, f10, rawhide yet?

Note You need to log in before you can comment on or make changes to this bug.