This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/14990] getaddrinfo with servname=NULL returns duplicate addresses


http://sourceware.org/bugzilla/show_bug.cgi?id=14990

Ruslan N. Marchenko <me at ruff dot mobi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me at ruff dot mobi

--- Comment #4 from Ruslan N. Marchenko <me at ruff dot mobi> 2013-03-07 07:27:40 UTC ---
Hi Pavel,
You probably better look at it from perspective of C call, not python wrapper.
In C it is clear - you're asking for host:service information, providing the
rest as hints.
As such, if service is empty, all hints which should make service more specific
are useless and should be ignored. Hence getaddrinfo(something,null,whatever)
should always return RAW. 
Similarly asking for RAW should ignore service since there's no service for raw
socket.
This is akin to combination of AI_PASSIVE and host NULL - both having similar
mining although using PASSIVE  with non-null host has no sense and PASSIVE flag
is discarded. The difference is that we don't have documented behaviour of
srv=null without RAW.

Anyway, here's what C call returns:

getaddrinfo(localhost,(null),{AF=0,ST=0,FLAGS=0})=0
socket(10, 1, 6)
socket: Success
getnameinfo: Success
 [::1:0] ---> [localhost:(null)]
socket(10, 2, 17)
socket: Success
getnameinfo: Success
 [::1:0] ---> [localhost:(null)]
socket(10, 3, 0)
socket: Protocol not supported
socket(2, 1, 6)
socket: Protocol not supported
getnameinfo: Protocol not supported
 [127.0.0.1:0] ---> [localhost:(null)]
socket(2, 2, 17)
socket: Protocol not supported
getnameinfo: Protocol not supported
 [127.0.0.1:0] ---> [localhost:(null)]
socket(2, 3, 0)
socket: Protocol not supported


I.e. similar results.

This list is returned by gaih_inet() (where all nasty things happen) 
line 375
          /* Neither socket type nor protocol is set.  Return all socket types
             we know about.  */

and successfully passed through deprecation validation and sorting, and not a
piece of code bothered to strip off unneeded results. Will submit patch later.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]