From owner-cvs-all Sun Jul 22 4:27:53 2001 Delivered-To: cvs-all@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id 8A17137B403; Sun, 22 Jul 2001 04:27:37 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.4/8.11.4) with ESMTP id f6MBRYL16658; Sun, 22 Jul 2001 12:27:34 +0100 (BST) (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.4/8.11.4) with ESMTP id f6MBRXg02996; Sun, 22 Jul 2001 12:27:33 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200107221127.f6MBRXg02996@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Hajimu UMEMOTO 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 In-Reply-To: Message from Hajimu UMEMOTO of "Sun, 22 Jul 2001 13:05:34 +0900." <20010722.130534.28837728.ume@mahoroba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 22 Jul 2001 12:27:33 +0100 From: Brian Somers Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Hi, > > >>>>> On Sat, 21 Jul 2001 23:22:55 +0100 > >>>>> Brian Somers 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 http://www.freebsd-services.com/ Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message