From owner-cvs-all Sun Jul 22 13:12: 2 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 5B68437B403; Sun, 22 Jul 2001 13:11:53 -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 f6MKBpL18658; Sun, 22 Jul 2001 21:11:51 +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 f6MKBog08546; Sun, 22 Jul 2001 21:11:50 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200107222011.f6MKBog08546@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 "Mon, 23 Jul 2001 03:23:54 +0900." <20010723.032354.31691239.ume@mahoroba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 22 Jul 2001 21:11:50 +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 > Umm, getaddrinfo(3) searches AAAA RR even if AF_UNSPEC is specified. > What's happen? > > brian> Interestingly enough, getaddrinfo seemed to be returning two > brian> 172.16.0.1 INET entries when it was given AF_UNSPEC in the hints.... > brian> I don't know if that's relevant in any way though. > > I see. realhostname_sa(3) didn't initialize hints correctly. Please > try this: > > Index: lib/libutil/realhostname.c > =================================================================== > RCS file: /home/ncvs/src/lib/libutil/realhostname.c,v > retrieving revision 1.12 > diff -u -r1.12 realhostname.c > --- lib/libutil/realhostname.c 2001/07/21 00:18:54 1.12 > +++ lib/libutil/realhostname.c 2001/07/22 18:20:19 > @@ -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; > @@ -111,7 +112,8 @@ > hints.ai_family = AF_UNSPEC; > break; > } > - hints.ai_flags = AI_CANONNAME; > + hints.ai_flags = AI_CANONNAME | AI_PASSIVE; > + hints.ai_socktype = SOCK_STREAM; > > error = getaddrinfo(buf, NULL, &hints, &res); > if (error) { > With this patch, getaddrinfo() only comes back with the A record, and realhostname_sa() fails (because it's not the same as the connecting IPv6 number). I'd try to be of more help, but I'm still confused about the intention of the getaddrinfo() hints. For the ::ffff:w.x.y.z addresses, surely looking that up and getting whatever w.x.y.z's PTR record refers to, then trying to get an A record back from that will just end up with ``w.x.y.z'' -- which won't match the original IP and will just make things fail. I'm assuming the following DNS setup now: $ORIGIN y.x.w.in-addr.any. z IN PTR some.domain.name. $ORIGIN domain.name. some IN A w.x.y.z If you could give me a better idea about what's supposed to happen (or point me at an RFC or something) it'd be appreciated. Sorry to be such a PITA :-/ > -- > 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/ Thanks. -- 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