[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #14 from dreamc...@gmail.com ---
Just for completeness (and not to forget it), here is link to IPV4 tutorial
page. Which was the most helpful to improve / fix today this parts of broken
networking code (where error occurred).

http://long.ccaba.upc.edu/long/045Guidelines/eva/ipv6.html

Many thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

Benjamin Kaduk  changed:

   What|Removed |Added

 Status|In Discussion   |Issue Resolved
 Resolution|--- |Works As Intended

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #13 from dreamc...@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.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #12 from Benjamin Kaduk  ---
(In reply to dreamcat4 from comment #11)
> 
> Gist link is updated to reflect that,
> https://gist.github.com/dreamcat4/86706bba25c468fc0ecc
> 

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #11 from dreamc...@gmail.com ---
(In reply to Benjamin Kaduk from comment #10)
> I think you are looking at the /usr/include/sys/socket.h from an OS X
> machine, not a FreeBSD machine.  On my FreeBSD machine, AF_INET6 is decimal
> 28, matching the 0x1c you see.

Yes. Oh sorry! Been looking in the wrong window. Silly me.

And my test program should be:

  if ( (addrinfo) && (addrinfo->ai_family == hints.ai_family) )
 ^^^ 
in order to filter on the same requested / returned type.   

Gist link is updated to reflect that,
https://gist.github.com/dreamcat4/86706bba25c468fc0ecc


BTW

This bug I have observed on FreeBSD 9.2-RELEASE. It is also suspected to occur
on 9.3, 10.0, and high. I just don't have any newer FreeBSD servers to test it
on. Can check on them by running this program 'test.c'.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #10 from Benjamin Kaduk  ---
(In reply to dreamcat4 from comment #9)
> For PF_INET6 hints, the returned structure says it is of type ai_family
> '0x1C' (which is '28' in decimal base 10).
> 
> If we look in the header file '/usr/include/sys/socket.h', we see that
> returned type is: AF_ISDN
> 
> :/
> 
> Maybe that aught to be a returned value of type '30' (0x1E) for PF_INET6.
> Since that was the type we actually requested?
> 
> 
> #define pseudo_AF_PIP 25  /* Help Identify PIP packets */
> #ifdef __APPLE__
> /*define pseudo_AF_BLUE   26 Identify packets for Blue Box - Not 
> used */
> #define AF_NDRV   27  /* Network Driver 'raw' access 
> */
> #endif
> #define   AF_ISDN 28  /* Integrated Services Digital 
> Network*/
> #define   AF_E164 AF_ISDN /* CCITT E.164 recommendation */
> #define   pseudo_AF_KEY   29  /* Internal key-management 
> function */
> #endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
> #define   AF_INET630  /* IPv6 */
> #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
> #define   AF_NATM 31  /* native ATM access */
> #ifdef __APPLE__
> #define AF_SYSTEM 32  /* Kernel event messages */

I think you are looking at the /usr/include/sys/socket.h from an OS X machine,
not a FreeBSD machine.  On my FreeBSD machine, AF_INET6 is decimal 28, matching
the 0x1c you see.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #9 from dreamc...@gmail.com ---
(In reply to Benjamin Kaduk from comment #8)
> I do not see why it is believed to be correct behavior to blindly cast
> addrinfo->ai_addr to type 'struct sockaddr_in *' without first checking that
> addrinfo->ai_family is PF_INET (or that the sockaddr's sa_family is
> AFS_INET); such a cast is expected to yield "nonsense" results when
> ai_family is PF_INET6.

I made the change you suggested.

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

For PF_INET6 hints, the returned structure says it is of type ai_family '0x1C'
(which is '28' in decimal base 10).

If we look in the header file '/usr/include/sys/socket.h', we see that returned
type is: AF_ISDN

:/

Maybe that aught to be a returned value of type '30' (0x1E) for PF_INET6. Since
that was the type we actually requested?


#define pseudo_AF_PIP25/* Help Identify PIP packets */
#ifdef __APPLE__
/*define pseudo_AF_BLUE26   Identify packets for Blue Box - Not used */
#define AF_NDRV27/* Network Driver 'raw' access */
#endif
#defineAF_ISDN28/* Integrated Services Digital Network*/
#defineAF_E164AF_ISDN/* CCITT E.164 recommendation */
#definepseudo_AF_KEY29/* Internal key-management function */
#endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#defineAF_INET630/* IPv6 */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#defineAF_NATM31/* native ATM access */
#ifdef __APPLE__
#define AF_SYSTEM32/* Kernel event messages */

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

Benjamin Kaduk  changed:

   What|Removed |Added

 CC||b...@freebsd.org

--- Comment #8 from Benjamin Kaduk  ---
I do not see why it is believed to be correct behavior to blindly cast
addrinfo->ai_addr to type 'struct sockaddr_in *' without first checking that
addrinfo->ai_family is PF_INET (or that the sockaddr's sa_family is AFS_INET);
such a cast is expected to yield "nonsense" results when ai_family is PF_INET6.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-07-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #7 from dreamc...@gmail.com ---
Should this PR really be in 'Documentation' ? Or 'Base System' ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"


[Bug 189268] 3 getaddrinfo(3) - hostanme="localhost", but it returns IN_ADDR_ANY (0.0.0.0)

2014-06-22 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189268

--- Comment #6 from dreamc...@gmail.com ---
(In reply to Allan Jude from comment #5)
> So do you still think there is an issue here? or can I close this PR?
> Allan Jude

Yeah I believe this one should stay open because it was discovered as a bug
when such a query was being executed by a real piece of software (virtualbox).

Rationale: The virtualbox source code running this query was multi platform. If
their developers can only test their work on one platform (for example linux),
and result the other platform works correctly... they kindda need to be able to
assume it work's gonna the same way on FreeBSD too.

Problem Recap.

In short. The problem is that: running a "localhost" DNS query should never be
returning "0.0.0.0" anywhere in it's results list. As "0.0.0.0" != "localhost".

This bug occurs if the protocol family being requested is set to
"PF_UNSPEC" (unspecified). OR "PF_INET6". With the default "/etc/hosts"
file (with a line that says "::1 localhost").

The bug is more likely to occur on new "IPV4+IPV6" code. The bug may not be
evident on older IP4-only code, if the DNS query's "protocol family" struct
field was set to "PF_INET4".

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-doc@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-doc
To unsubscribe, send any mail to "freebsd-doc-unsubscr...@freebsd.org"