On 2013/03/30 14:39, Alexander Bluhm wrote:
> Hi,
> 
> Using IO::Socket::INET6 fails when creating raw sockets.  Our
> getaddrinfo() seems to behave more strictly.  This is not related
> to new perl or new resolver.  I was also broken in OpenBSD 5.0.

It looks like IO::Socket::INET in base perl would be affected too.

Most other OS are going to be using something closer to the libbind
(ISC) resolver which allows this so I think it would make more sense to
adjust getaddrinfo_async_run() to allow '0' for raw sockets, rather
than patch users.

Thinking possibly something like this, but untested:

Index: getaddrinfo_async.c
===================================================================
RCS file: /cvs/src/lib/libc/asr/getaddrinfo_async.c,v
retrieving revision 1.12
diff -u -p -r1.12 getaddrinfo_async.c
--- getaddrinfo_async.c 28 Mar 2013 11:47:23 -0000      1.12
+++ getaddrinfo_async.c 30 Mar 2013 14:28:18 -0000
@@ -170,7 +170,9 @@ getaddrinfo_async_run(struct async *as, 
                }
 
                if (ai->ai_socktype == SOCK_RAW &&
-                   as->as.ai.servname != NULL) {
+                   as->as.ai.servname != NULL &&
+                   get_port(as->as.ai.servname, NULL,
+                   as->as.ai.hints.ai_flags & AI_NUMERICSERV) != 0) {
                        ar->ar_gai_errno = EAI_SERVICE;
                        async_set_state(as, ASR_STATE_HALT);
                        break;


Reply via email to