Date: Mon, 23 Jul 2001 05:52:25 +0900 (JST) From: Hajimu UMEMOTO <ume@mahoroba.org> To: brian@Awfulhak.org Cc: brian@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libutil realhostname.c Message-ID: <20010723.055225.111155784.ume@mahoroba.org> In-Reply-To: <200107222011.f6MKBog08546@hak.lan.Awfulhak.org> References: <ume@mahoroba.org> <200107222011.f6MKBog08546@hak.lan.Awfulhak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Sun, 22 Jul 2001 21:11:50 +0100
>>>>> Brian Somers <brian@Awfulhak.org> said:
brian> With this patch, getaddrinfo() only comes back with the A record, and
Yes, it is expected behavior.
brian> realhostname_sa() fails (because it's not the same as the connecting
brian> IPv6 number).
Umm, realhostname_sa() has a trick for this case. The past when I
tested it, it seemd working to me.
#ifdef INET6
/*
* XXX IPv4 mapped IPv6 addr consideraton,
* specified in rfc2373.
*/
if (sa->sa_family == AF_INET &&
addr->sa_family == AF_INET6) {
struct in_addr *in;
struct in6_addr *in6;
in = &((struct sockaddr_in *)sa)->sin_addr;
in6 = &((struct sockaddr_in6 *)addr)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(in6) &&
!memcmp(&in6->s6_addr[12], in,
sizeof(*in))) {
result = HOSTNAME_FOUND;
if (ores->ai_canonname == 0 ||
strlen(ores->ai_canonname) > hsize) {
freeaddrinfo(ores);
goto numeric;
}
strncpy(host, ores->ai_canonname,
hsize);
break;
}
}
#endif
brian> I'd try to be of more help, but I'm still confused about the
brian> intention of the getaddrinfo() hints. For the ::ffff:w.x.y.z
brian> addresses, surely looking that up and getting whatever w.x.y.z's PTR
brian> record refers to, then trying to get an A record back from that will
brian> just end up with ``w.x.y.z'' -- which won't match the original IP and
brian> will just make things fail.
When hostname is specified to getaddrinfo(3), getaddrinfo(3) doesn't
concern about mapped address. So, AF_INET is returned.
brian> I'm assuming the following DNS setup now:
brian> $ORIGIN y.x.w.in-addr.any.
brian> z IN PTR some.domain.name.
brian> $ORIGIN domain.name.
brian> some IN A w.x.y.z
It seems fine to me.
brian> If you could give me a better idea about what's supposed to happen
brian> (or point me at an RFC or something) it'd be appreciated. Sorry to
brian> be such a PITA :-/
Please refer RFC2373 and RFC2553.
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org ume@bisd.hitachi.co.jp ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010723.055225.111155784.ume>
