Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Apr 2008 02:40:16 +0530
From:      wahjava.ml@gmail.com (Ashish Shukla =?utf-8?B?4KSG4KS24KWA4KS3IA==?= =?utf-8?B?4KS24KWB4KSV4KWN4KSy?=)
To:        bms@freebsd.org
Cc:        FreeBSD Ports Mailing List <freebsd-ports@freebsd.org>
Subject:   dns/nss_mdns: getaddrinfo() doesn't return IPv6 address on getaddrinfo()
Message-ID:  <87lk30z5jb.fsf@chateau.d.lf>

next in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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:

=2D--->8---->8-----
diff -urN /usr/ports/dns/nss_mdns/Makefile nss_mdns/Makefile
=2D-- /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 @@
=20
 PORTNAME=3D	nss_mdns
 PORTVERSION=3D	0.9
=2DPORTREVISION=3D	5
+PORTREVISION=3D	6
 CATEGORIES=3D	dns ipv6
 MASTER_SITES=3D	http://0pointer.de/lennart/projects/nss-mdns/
 DISTNAME=3D	nss-mdns-${PORTVERSION}
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c nss_mdns/files/=
patch-src__bsdnss.c
=2D-- /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.
 +	 */
=2D+	status =3D _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
++	status =3D _nss_mdns_gethostbyname2_r(name, pai->ai_family, hp, buffer, =
mbuflen,
 +					   &_errno, &_h_errno);
 +	status =3D __nss_compat_result(status, _errno);
 +
=2D---8<----8<----

If required I'll submit a PR for this.

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

Thanks
=2D-=20
Ashish Shukla =E0=A4=86=E0=A4=B6=E0=A5=80=E0=A4=B7 =E0=A4=B6=E0=A5=81=E0=A4=
=95=E0=A5=8D=E0=A4=B2                      http://wahjava.wordpress.com/
=C2=B7-- =C2=B7- =C2=B7=C2=B7=C2=B7=C2=B7 =C2=B7--- =C2=B7- =C2=B7=C2=B7=C2=
=B7- =C2=B7- =C2=B7--=C2=B7-=C2=B7 --=C2=B7 -- =C2=B7- =C2=B7=C2=B7 =C2=B7-=
=C2=B7=C2=B7 =C2=B7-=C2=B7-=C2=B7- -=C2=B7-=C2=B7 --- --

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIE5o8Hy+EEHYuXnQRAnrCAJ9V/SAWi2zUqstERbcOono9GD5+MgCgiMsv
V38bmRY9PKMvCG9bNlh54cc=
=x3KL
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87lk30z5jb.fsf>