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

--- Comment #5 from Pavel Åimerda <psimerda at redhat dot com> 2013-03-07 12:00:27 UTC ---
(In reply to comment #4)
> Hi Pavel,
> You probably better look at it from perspective of C call, not python wrapper.

Please look at it from the perspective of both the POSIX standard and the fact
that getaddrinfo() was designed to replace both gethostbyname().

I don't know why you bring Python into the discussion when the Python interface
is exactly 1:1 to the C interface except the hints are expanded. Python is only
used because it is more convenient for testing.

> you're asking for host:service information, providing the rest as hints.

Correct, unless some of the hints have special meaning on their own.

> As such, if service is empty, all hints which should make service
> more specific are useless and should be ignored.

Correct.

Hence getaddrinfo(something,null,whatever)
> should always return RAW.

Incorrect, in my opinion. I am curious about your explenation taking into
account POSIX and/or real-world use cases. There's IMO no reason to return RAW
unless the caller wants it.

> Similarly asking for RAW should ignore service since there's no service
> for raw socket.

I don't say you are not right here but you contradict yourself, as asking for
RAW is only possible using the hints. Above you asked hints to be always
ignored when service is NULL.

> 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.

This is wrong. Using AI_PASSIVE with non-null host makes perfect sense even
though AI_PASSIVE is ignored then. You and many others are forgetting that the
flags and the values usually don't come from the same source.

The programmer uses AI_PASSIVE without the knowledge whether the host will be
NULL or non-NULL, which is determined by the user configuration. This is a
convenience tool so that allows the programmer to use the same getaddrinfo()
interface regardless the user input.

> The difference is that we don't have documented behaviour of
> srv=null without RAW.

> Anyway, here's what C call returns:

The Python function is a convenience wrapper over the C call, there's no need
to compare them.

The patch is already available as part of my patchset:

http://git.pavlix.net/gitweb/?p=glibc.git;a=shortlog;h=refs/heads/pavlix/getaddrinfo

-- 
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]