test_getaddrinfo fails on systems that don't have any (non-loopback) IPv6 addresses configured: $ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 valid_lft forever preferred_lft forever $ ctest --force-new-ctest-process --verbose -R getaddrinfo UpdateCTestConfiguration from :/home/jwilk/nss_wrapper-1.0.2/obj/tests/DartConfiguration.tcl UpdateCTestConfiguration from :/home/jwilk/nss_wrapper-1.0.2/obj/tests/DartConfiguration.tcl Test project /home/jwilk/nss_wrapper-1.0.2/obj/tests Constructing a list of tests Done constructing a list of tests Checking test dependency graph... Checking test dependency graph end test 2 Start 2: test_getaddrinfo 2: Test command: /home/jwilk/nss_wrapper-1.0.2/obj/tests/test_getaddrinfo 2: Test timeout computed to be: 9.99988e+06 2: [==========] Running 7 test(s). 2: [ RUN ] test_nwrap_getaddrinfo 2: [ OK ] test_nwrap_getaddrinfo 2: [ RUN ] test_nwrap_getaddrinfo_any 2: [ OK ] test_nwrap_getaddrinfo_any 2: [ RUN ] test_nwrap_getaddrinfo_local 2: [ OK ] test_nwrap_getaddrinfo_local 2: [ RUN ] test_nwrap_getaddrinfo_name 2: [ OK ] test_nwrap_getaddrinfo_name 2: [ RUN ] test_nwrap_getaddrinfo_service 2: [ OK ] test_nwrap_getaddrinfo_service 2: [ RUN ] test_nwrap_getaddrinfo_null 2: 0xfffffffffffffffe != 0 2: /home/jwilk/nss_wrapper-1.0.2/tests/test_getaddrinfo.c:291: error: Failure! 2: [ FAILED ] test_nwrap_getaddrinfo_null 2: [ RUN ] test_nwrap_getaddrinfo_ipv6 2: [ OK ] test_nwrap_getaddrinfo_ipv6 2: [==========] 7 test(s) run. 2: [ PASSED ] 6 test(s). 2: [ FAILED ] 1 test(s), listed below: 2: [ FAILED ] test_nwrap_getaddrinfo_null 1/1 Test #2: test_getaddrinfo .................***Failed 1.52 sec 0% tests passed, 1 tests failed out of 1 Total Test time (real) = 1.54 sec The following tests FAILED: 2 - test_getaddrinfo (Failed) Errors while running CTest
If you pass a NULL as the node than we call into the glibc to let it handle the getaddrinfo() which fails on your host. So you should check the return value of getaddrinfo(). Maybe print it with gai_strerror(). Looks like a bug in glibc...
The error is EAI_NONAME ("Name or service not known"). This is documented behavior of getaddrinfo(): “If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by res only if the local system has at least one IPv4 address configured, and IPv6 addresses are returned only if the local system has at least one IPv6 address configured. The loopback address is not considered for this case as valid as a configured address.”
Then I think the hints flags should be set to (AI_V4MAPPED | AI_ADDRCONFIG)
Can you test with those flags?
If you set flags to AI_V4MAPPED | AI_ADDRCONFIG, the test still fails with EAI_NONAME. However it succeeds if you set flags to AI_V4MAPPED alone, or to 0.
any update on this?
This has been fixed with: https://git.samba.org/?p=nss_wrapper.git;a=commitdiff;h=fa20a56d4126dd5b111d06f84442dc972f024313