Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2014 17:34:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-doc@FreeBSD.org
Subject:   [Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)
Message-ID:  <bug-189268-9-ZAQfo8jTiG@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-189268-9@https.bugs.freebsd.org/bugzilla/>
References:  <bug-189268-9@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #13 from dreamcat4@gmail.com ---
(In reply to Benjamin Kaduk from comment #12)
> (In reply to dreamcat4 from comment #11)
> No, this is still incorrect.  The point I was making, is that the ai_addr
> field must be cast to the type 'struct sockaddr_in6 *' (note the '6') when
> it is in the INET6 family.  Your code is still using 'struct sockaddr_in *',
> which is incorrect.

Thanks Ben! I am pleased to say that with that change, the new version of
'test.c' and test result you can see here:

https://gist.github.com/dreamcat4/86706bba25c468fc0ecc

So this proves that there is no bug in getaddrinfo. My bug report is invalid.
This also proves there is definitely some bug in GSOAP library (which the
previous version of this 'test.c' program was exactly reproducing).

Many thanks.

Bug is on GSOAP. As previously stated in my very 1st comment:


stdsoap2.cpp:4143:
  err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo);

Is passing in "localhost", is told "0.0.0.0". Then later on in soap_bind(), the
returned address "0.0.0.0" is passed into bind(). And bind() then binds to ALL
interfaces. 

We can see as of today, comparing before and after, the '0.0.0.0' is occur
because incorrect cast of structure members. When the INET6 structure actually
contain '::1' ipv6 address for localhost.

Appreciate this. It clarifies the issue totally.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-189268-9-ZAQfo8jTiG>