public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15015] New: getaddrinfo returns EAI_SERVICE with SOCK_RAW
@ 2013-01-12 23:25 pablo at gnumonks dot org
  2013-01-12 23:29 ` [Bug libc/15015] " pablo at gnumonks dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: pablo at gnumonks dot org @ 2013-01-12 23:25 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 15015
           Summary: getaddrinfo returns EAI_SERVICE with SOCK_RAW
           Product: glibc
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: pablo@gnumonks.org
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Hi,

getaddrinfo returns EAI_SERVICE with SOCK_RAW. That's consistent with what you
can read at sysdeps/posix/getaddrinfo.c, line 125:

  { SOCK_RAW, 0, GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE, true, "raw" }
                                    ^-----------------^

That function returns that error if the GAI_PROTO_NOSERVICE flag is set.

However, strace shows that, when getaddrinfo is called with SOCK_RAW, the
address information is retrieves from the kernel via netlink as this trace
below shows:

$ strace ./fr
[...]
socket(PF_NETLINK, SOCK_RAW, 0)         = 3
bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
getsockname(3, {sa_family=AF_NETLINK, pid=5936, groups=00000000}, [12]) = 0
sendto(3, "\24\0\0\0\26\0\1\3+\230\256P\0\0\0\0\0\0\0\0", 20, 0,
{sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"0\0\0\0\24\0\2\0+\230\256P0\27\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"...,
4096}], msg_controllen=0, msg_flags=0}, 0) = 108
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"@\0\0\0\24\0\2\0+\230\256P0\27\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"...,
4096}], msg_controllen=0, msg_flags=0}, 0) = 128
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"\24\0\0\0\3\0\2\0+\230\256P0\27\0\0\0\0\0\0\1\0\0\0\24\0\1\0\0\0\0\0"...,
4096}], msg_controllen=0, msg_flags=0}, 0) = 20

Let me decipher that netlink trace:

1) bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
                                                           ^^
   bind this socket to rtnetlink

2) Send the request message to ask for the address information.

sendto(3, "\24\0\0\0\26\0\1\3+\230\256P\0\0\0\0\0\0\0\0", 20, 0,
{sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20

3) This gets the multipart message with the information that we
requested:

recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"0\0\0\0\24\0\2\0+\230\256P0\27\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"...,
4096}], msg_controllen=0, msg_flags=0}, 0) = 108
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(1)=[{"@\0\0\0\24\0\2\0+\230\256P0\27\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"...,
4096}], msg_controllen=0, msg_flags=0}, 0) = 128
recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},

But, even if the information is successfully retrieved, it is later on
discarded because of using SOCK_RAW.

Is there any reason for that behaviour? It seems inconsistent to me, ie.
retrieve address records from the kernel correctly but, later on, discard them
because that flag is set.

Thank you!

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-09-27  6:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-12 23:25 [Bug libc/15015] New: getaddrinfo returns EAI_SERVICE with SOCK_RAW pablo at gnumonks dot org
2013-01-12 23:29 ` [Bug libc/15015] " pablo at gnumonks dot org
2013-01-14 13:36 ` schwab@linux-m68k.org
2013-01-14 23:44 ` pablo at gnumonks dot org
2013-01-14 23:48 ` schwab@linux-m68k.org
2013-10-20 20:28 ` neleai at seznam dot cz
2014-02-07  2:52 ` [Bug network/15015] " jsm28 at gcc dot gnu.org
2014-02-07  9:55 ` pablo at gnumonks dot org
2014-02-13 15:59 ` asn at cryptomilk dot org
2014-02-13 16:00 ` asn at cryptomilk dot org
2014-06-13 19:04 ` fweimer at redhat dot com
2014-06-14  5:24 ` fweimer at redhat dot com
2014-09-27  6:28 ` aoliva at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).