From owner-freebsd-doc@FreeBSD.ORG Sat May 3 07:40:01 2014 Return-Path: Delivered-To: freebsd-doc@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B39BA0B for ; Sat, 3 May 2014 07:40:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C0BB1E4A for ; Sat, 3 May 2014 07:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s437e0g6011843 for ; Sat, 3 May 2014 07:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s437e0Bs011842; Sat, 3 May 2014 07:40:00 GMT (envelope-from gnats) Date: Sat, 3 May 2014 07:40:00 GMT Message-Id: <201405030740.s437e0Bs011842@freefall.freebsd.org> To: freebsd-doc@FreeBSD.org Cc: From: Dreamcat4 Subject: Re: docs/189268: 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0) X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Dreamcat4 List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 07:40:01 -0000 The following reply was made to PR docs/189268; it has been noted by GNATS. From: Dreamcat4 To: bug-followup@freebsd.org, dreamcat4@gmail.com Cc: Subject: Re: docs/189268: 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0) Date: Sat, 3 May 2014 08:29:44 +0100 --089e012953d0181fd904f879df3a Content-Type: text/plain; charset=UTF-8 Ah, I have researched a little more. It is my impression that the expected result aught to be "::1" if the protocol family was PF_UNSPEC or PF_INET6. Now that Allan has mentioned it. Commenting out the ::1 in /etc/hosts does change the result. However that isn't something the gSOAP library which is making that API call has any control over. Also: This bug occurs when the protocol family being requested is set to "PF_UNSPEC" (unspecified). OR "PF_INET6". With the default "/etc/hosts" file (where that ::1 localhost entry exists). Wheras setting: hints.ai_family = PF_INET; returns 127.0.0.1 regardless of the ::1 in /etc/hosts file. Setting: hints.ai_family = PF_INET6; also gives such incorrect "0.0.0.0", except if commenting out ::1 in /etc/hosts as Alan says. Then it gives: getaddrinfo ~/ root~# gcc test.c -o test && ./test getaddrinfo failed with code 8. Which would be correct to error out since no corresponding ip6 address found. The gSOAP library seems to choose PF_UNSPEC because they want to support both ipv4 and ipv6 protocols simultaneously (as many others also do). I'm not sure if they could fix downstream the issue by avoiding PF_UNSPEC because the bug will still occur on PF_INET6. Anyway. Heres is the gSOAP code where getaddrinfo() is being called in "soap_bind()": http://sourceforge.net/p/gsoap2/code/HEAD/tree/gsoap/stdsoap2.cpp#l4789 http://sourceforge.net/p/gsoap2/code/HEAD/tree/gsoap/stdsoap2.cpp#l4791 Then later on in soap_bind() the incorrect address (0.0.0.0), is used are the parameter being passed into bind() http://sourceforge.net/p/gsoap2/code/HEAD/tree/gsoap/stdsoap2.cpp#l4876 --089e012953d0181fd904f879df3a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Ah,
I have researched a little more. I= t is my impression that the expected result aught to be "::1" if = the protocol family was PF_UNSPEC or PF_INET6.

Now that Allan has mentioned it. Commenting out the ::1 in /etc/hosts does = change the result. However that isn't something the gSOAP library which= is making that API call has any control over.

Also:

This bug occurs when the protocol family being requeste= d is set to "PF_UNSPEC" (unspecified). OR "PF_INET6". W= ith the default "/etc/hosts" file (where that ::1 localhost entry= exists).

Wheras setting:

hints.ai_famil= y =C2=A0 =3D PF_INET;

returns 127.0.0.1 regardless= of the ::1 in /etc/hosts file.

Setting:
=

hints.ai_family =C2=A0 =3D PF_INET6;
also gives such incorrect "0.0.0.0", except if comme= nting out ::1 in /etc/hosts as Alan says.

Then it = gives:

getaddrinfo ~/ root~# gcc test.c -o test &&= ; ./test
getaddrinfo failed with code 8.

Which would be correct to error out since no corresponding ip6 addre= ss found.


The gSOAP library seems to choose PF_UNS= PEC because they want to support both ipv4 and ipv6 protocols simultaneousl= y (as many others also do). I'm not sure if they could fix downstream t= he issue by avoiding PF_UNSPEC because the bug will still occur on PF_INET6= .


Anyway. Heres is the gSOAP code wh= ere getaddrinfo() is being called in "soap_bind()":


Then later= on in soap_bind() the incorrect address (0.0.0.0), is used are the paramet= er being passed into bind()



--089e012953d0181fd904f879df3a--