Date: Sun, 22 Jul 2001 12:27:33 +0100 From: Brian Somers <brian@Awfulhak.org> To: Hajimu UMEMOTO <ume@mahoroba.org> Cc: brian@Awfulhak.org, brian@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@Awfulhak.org Subject: Re: cvs commit: src/lib/libutil realhostname.c Message-ID: <200107221127.f6MBRXg02996@hak.lan.Awfulhak.org> In-Reply-To: Message from Hajimu UMEMOTO <ume@mahoroba.org> of "Sun, 22 Jul 2001 13:05:34 %2B0900." <20010722.130534.28837728.ume@mahoroba.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Hi,
>
> >>>>> On Sat, 21 Jul 2001 23:22:55 +0100
> >>>>> Brian Somers <brian@Awfulhak.org> said:
>
> brian> Do you mean ::ffff:a.b.c.d type addresses ? I'm probably
>
> Yes.
>
> brian> mis-understanding things. Can you give me an example of how such a
> brian> connection is supposed to work ? I mean... if ::ffff:* addresses
> brian> aren't supposed to understand IPv6, why are they a concern ? I'm
> brian> clearly missing something.
>
> In default settings of FreeBSD, IPv4 mapped IPv6 address is enabled.
> And, most of IPv6 support codes in basic part of FreeBSD concern about
> it. For example, you can specify `tcp46' in inetd.conf to use it.
> Make sure to don't specify `tcp' for the same service. You can try it
> with sshd too. For sshd, you can specify `ListenAddress ::' in
> sshd_config.
But with such services enabled, surely the connection's sockaddr will
show up as ::ffff:w.x.y.z where w.x.y.z is the IPv4 address of the
connecting host ? I'm guessing that if such an address is going to
reverse resolve, then the forward resolution should be available too,
meaning reverse dns:
$ORIGIN f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.INT.
z.y.x.w IN PTR some.domain.name.
and forward dns:
$ORIGIN domain.name.
some IN A w.x.y.z
IN AAAA ::ffff:w.x.y.z
or is the DNS for such connections meant to magically DTRT without
the above entries ?
> brian> My change was done because the normal IPv6 scenario doesn't work at
> brian> the moment (where I have gw.lan.Awfulhak.org resolving an A request
> brian> to 172.16.0.1 and an AAAA request to fec0::1). When I connect from
> brian> fec0::1 it simply fails to resolve using AF_UNSPEC and dumps fec0::1
> brian> in utmp :(
>
> Umm, it's a site-local address. Since site-local address is a scoped
> address, we may need some other concern to play with it. Does this
> work for you?
>
> Index: lib/libutil/realhostname.c
> diff -u lib/libutil/realhostname.c.orig lib/libutil/realhostname.c
> --- lib/libutil/realhostname.c.orig Sun Jul 22 04:47:07 2001
> +++ lib/libutil/realhostname.c Sun Jul 22 13:01:24 2001
> @@ -96,7 +96,8 @@
>
> result = HOSTNAME_INVALIDADDR;
>
> - error = getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0, 0);
> + error = getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0,
> + NI_WITHSCOPEID);
> if (error == 0) {
> struct addrinfo hints, *res, *ores;
> struct sockaddr *sa;
Unfortunately this doesn't work. getnameinfo() already does the
right thing (it gets the name from the ip6.int entry in my DNS) which
says:
$ORIGIN 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.c.e.f.IP6.INT.
1.0.0.0.0 IN PTR gw.lan.Awfulhak.org.
the problem was that giving getaddrinfo() hints with AF_UNSPEC only
brought back the A records, and not the AAAA records for the name.
My DNS says:
$ORIGIN lan.Awfulhak.org.
gw IN A 172.16.0.1
IN AAAA fec0::1
Giving getaddrinfo() hints with AF_INET6 gets the AAAA record.
Interestingly enough, getaddrinfo seemed to be returning two
172.16.0.1 INET entries when it was given AF_UNSPEC in the hints....
I don't know if that's relevant in any way though.
> --
> 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/
--
Brian <brian@freebsd-services.com> <brian@Awfulhak.org>
http://www.freebsd-services.com/ <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org>
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?200107221127.f6MBRXg02996>
