dns/nss_mdns: getaddrinfo() doesn't return IPv6 address on getaddrinfo()

Ashish Shukla आशीष शुक्ल wahjava.ml at gmail.com
Sat Apr 26 21:10:15 UTC 2008


Hi,

Whenever I execute getaddrinfo() function from libc with a 'hostname.local'
address as an argument and AF_INET6 as ai.ai_family, I get an IPv4
address, even when 'avahi-resolve-host-name -6 hostname.local' returns
an IPv6 address.

I've written a test program getaddrinfo.c[1] which does a
getaddrinfo() function call and prints the result on the terminal.

Following is the patch to port dns/nss_mdns which will fix this issue:

---->8---->8-----
diff -urN /usr/ports/dns/nss_mdns/Makefile nss_mdns/Makefile
--- /usr/ports/dns/nss_mdns/Makefile	2008-01-03 17:53:37.000000000 +0530
+++ nss_mdns/Makefile	2008-04-27 01:22:10.000000000 +0530
@@ -7,7 +7,7 @@
 
 PORTNAME=	nss_mdns
 PORTVERSION=	0.9
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	dns ipv6
 MASTER_SITES=	http://0pointer.de/lennart/projects/nss-mdns/
 DISTNAME=	nss-mdns-${PORTVERSION}
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c nss_mdns/files/patch-src__bsdnss.c
--- /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c	2007-04-12 16:13:15.000000000 +0530
+++ nss_mdns/files/patch-src__bsdnss.c	2008-04-27 01:19:18.000000000 +0530
@@ -197,7 +197,7 @@
 +	 * 2. Map hostent to addrinfo.
 +	 * 3. Hand-off buffer to libc.
 +	 */
-+	status = _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
++	status = _nss_mdns_gethostbyname2_r(name, pai->ai_family, hp, buffer, mbuflen,
 +					   &_errno, &_h_errno);
 +	status = __nss_compat_result(status, _errno);
 +
----8<----8<----

If required I'll submit a PR for this.

References:
[1] - http://pastebin.com/f20d45049

Thanks
-- 
Ashish Shukla आशीष शुक्ल                      http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20080426/b352739c/attachment.pgp


More information about the freebsd-ports mailing list