NetBSD Problem Report #54527

From www@netbsd.org  Thu Sep  5 22:01:06 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B0AFF7A174
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  5 Sep 2019 22:01:06 +0000 (UTC)
Message-Id: <20190905220105.40A7F7A1C1@mollari.NetBSD.org>
Date: Thu,  5 Sep 2019 22:01:05 +0000 (UTC)
From: anthony.mallet@useless-ficus.net
Reply-To: anthony.mallet@useless-ficus.net
To: gnats-bugs@NetBSD.org
Subject: syslogd hangs when forwarding logs to a IPv6 host that is down
X-Send-Pr-Version: www-1.0

>Number:         54527
>Category:       lib
>Synopsis:       syslogd hangs when forwarding logs to a IPv6 host that is down
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 05 22:05:01 +0000 2019
>Closed-Date:    Tue Apr 21 19:45:49 +0000 2020
>Last-Modified:  Wed Apr 22 10:25:01 +0000 2020
>Originator:     Anthony Mallet
>Release:        -current
>Organization:
>Environment:
NetBSD 9.99.10 (CACTUS) #0: Sun Aug 25 22:06:15 CEST 2019 amd64
>Description:
syslogd deadlocks when it sends a UDP log line to a IPv6 remote host
that is down. It appears to hang on:

(gdb) where
#0  0x00007f7ff5f338ba in recvfrom () from /usr/lib/libc.so.12
#1  0x0000000000207e48 in dispatch_read_finet (fd=9, event=2, 
    ev=0x7f7ff7ee3380) at /usr/src/usr.sbin/syslogd/syslogd.c:802

Before that, it correctly sends the log with no error:
2019-09-05T23:20:47.331842+02:00:/usr/src/usr.sbin/syslogd/syslogd.c:udp_send:2588      udp_send(f=0x7f7ff7be1800, line="<11>Sep  5 23:20:47 cactus tho: x", len=33) to dest.

On the network one can see the ICMP6 neighbor solicitation packets that 
are not replied. And after that, for some reason, the sending socket is
marked as readable by libevent and syslogd tries to read from it.
The socket is actually not readable, so the recvfrom() blocks forever.

This does not happen if the remote host is up. Nor if it's down and syslogd uses its IPv4 address.

The problem is not new, I've be experiencing this since at least December 2018 (but I only recently discovered the real cause).

>How-To-Repeat:
Pick up an unused IPv6 address on the local network and:
# echo 'user.error @ipv6.host.down' >> /etc/syslogd.conf
# syslogd -d
# logger -p user.error x

syslogd should become unresponsive after a few seconds.

>Fix:
I have no idea if the socket is expected to become readable in this situation.
A possible workaround would then be to mark is as non-blocking?

>Release-Note:

>Audit-Trail:
From: Anthony Mallet <anthony.mallet@useless-ficus.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/54527: syslogd hangs when forwarding logs to a IPv6 host that is down
Date: Sat, 14 Sep 2019 15:26:49 +0200

 --izN8ETk60E
 Content-Type: text/plain; charset=us-ascii
 Content-Description: message body text
 Content-Transfer-Encoding: 7bit

 I could finally debug this further. The problem is the following:

 When syslog sends a udp datagram to the remote, unreachable IPv6 host,
 the socket is marked readable and a recv on it will return
 EHOSTDOWN. So far so good.

 However, there is a call to libwrap "fromhost" (syslogd.c:795) that
 eats the error and prevents the further "recvfrom" (syslog.c:802) from
 getting it (that's why recvfrom then block forever).
 I attach a sample program that shows the issue more clearly.

 For UDP sockets, libwrap does "recvfrom( ... MSG_PEEK ...)" to
 determine the remote address. This is the call that gets the
 EHOSTDOWN. However, the hostfrom() function does not return errors, so
 syslogd cannot use this information to avoid the blocking recvfrom().

 Not sure what to do ...


 --izN8ETk60E
 Content-Type: text/plain;
 	 name="sock.c"
 Content-Disposition: inline;
 	 filename="sock.c"
 Content-Transfer-Encoding: 7bit

 #include <sys/socket.h>
 #include <netinet/in.h>

 #include <err.h>
 #include <event.h>
 #include <netdb.h>
 #include <poll.h>

 int
 main()
 {
   struct addrinfo hints = { 0 }, *res, *r;
   struct sockaddr_storage frominet;
   struct pollfd fds;
   socklen_t len;
   char buf[16];
   ssize_t s;
   int error;
   int fd;

   /* setup sending socket */
   hints.ai_flags = AI_PASSIVE;
   hints.ai_family = AF_INET6;
   hints.ai_socktype = SOCK_DGRAM;
   error = getaddrinfo(NULL, "12345", &hints, &res);
   if (error) err(2, "getaddrinfo bind");

   for (r = res; r; r = r->ai_next) {
     fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
     if (fd < 0) err(2, "socket");

     if (bind(fd, r->ai_addr, r->ai_addrlen) < 0)
       err(2, "bind");

     break;
   }
   freeaddrinfo(res);

   /* non-existent host */
   hints.ai_flags = AI_NUMERICHOST;
   hints.ai_family = AF_INET6;
   hints.ai_socktype = SOCK_DGRAM;
   error = getaddrinfo("fc00::", "12345", &hints, &res);
   if (error) err(2, "getaddrinfo sendto");

   /* send empty datagram */
   for (r = res; r; r = r->ai_next) {
     s = sendto(fd, "", 1, 0, r->ai_addr, r->ai_addrlen);
     if (s == -1)
       err(2, "sendto");
     warnx("sent %zd bytes", s);
     break;
   }
   freeaddrinfo(res);

   /* wait for events: sock will be readable and return EHOSTDOWN */
   while (1) {
     fds.fd = fd;
     fds.events = POLLIN;
     if (poll(&fds, 1, -1) == 1) {
       warnx("events %d %d", fds.events, fds.revents);

       /* do the equivalent of a libwarp "hostfrom" */
       len = sizeof(frominet);
       if (recvfrom(fd, buf, sizeof(buf), MSG_PEEK,
                    (struct sockaddr *)&frominet, &len) < 0) {
         warn("can't get client address");
       }

       /* this blocks because the EHOSTDOWN was eaten above */
       s = recv(fd, buf, sizeof(buf), 0);
       warn("recv %zd", s);
     }

     warnx("not reached :/");
   }

   return 0;
 }

 --izN8ETk60E--

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 anthony.mallet@useless-ficus.net
Subject: Re: lib/54527: syslogd hangs when forwarding logs to a IPv6 host that
 is down
Date: Sat, 14 Sep 2019 09:55:26 -0400

 --Apple-Mail=_70E39BE3-8289-4A32-8D7B-CFC363B47D63
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=us-ascii

 Congratulations, you found a kernel bug. MSG_PEEK is not supposed to =
 reset so->so_{r,}error.
 Try this (not even compile-tested).

 christos

 diff -u -u -r1.281 uipc_socket.c
 --- uipc_socket.c       16 Jul 2019 22:57:55 -0000      1.281
 +++ uipc_socket.c       14 Sep 2019 13:52:57 -0000
 @@ -928,7 +928,8 @@
                 }
                 if (so->so_error) {
                         error =3D so->so_error;
 -                       so->so_error =3D 0;
 +                       if ((flags & MSG_PEEK) =3D=3D 0)
 +                               so->so_error =3D 0;
                         goto release;
                 }
                 if ((so->so_state & SS_ISCONNECTED) =3D=3D 0) {
 @@ -1227,13 +1228,10 @@
                 if (so->so_error || so->so_rerror) {
                         if (m !=3D NULL)
                                 goto dontblock;
 -                       if (so->so_error) {
 -                               error =3D so->so_error;
 -                               so->so_error =3D 0;
 -                       } else {
 -                               error =3D so->so_rerror;
 -                               so->so_rerror =3D 0;
 -                       }
 +                       int *e =3D so->so_error ? &so->so_error : =
 &so->so_rerror;
 +                       error =3D *e;
 +                       if ((flags & MSG_PEEK) =3D=3D 0)
 +                               *e =3D 0;
                         goto release;
                 }
                 if (so->so_state & SS_CANTRCVMORE) {


 > On Sep 14, 2019, at 9:40 AM, Anthony Mallet =
 <anthony.mallet@useless-ficus.net> wrote:
 >=20
 > #include <sys/socket.h>
 > #include <netinet/in.h>
 >=20
 > #include <err.h>
 > #include <event.h>
 > #include <netdb.h>
 > #include <poll.h>
 >=20
 > int
 > main()
 > {
 >   struct addrinfo hints =3D { 0 }, *res, *r;
 >   struct sockaddr_storage frominet;
 >   struct pollfd fds;
 >   socklen_t len;
 >   char buf[16];
 >   ssize_t s;
 >   int error;
 >   int fd;
 >=20
 >   /* setup sending socket */
 >   hints.ai_flags =3D AI_PASSIVE;
 >   hints.ai_family =3D AF_INET6;
 >   hints.ai_socktype =3D SOCK_DGRAM;
 >   error =3D getaddrinfo(NULL, "12345", &hints, &res);
 >   if (error) err(2, "getaddrinfo bind");
 >=20
 >   for (r =3D res; r; r =3D r->ai_next) {
 >     fd =3D socket(r->ai_family, r->ai_socktype, r->ai_protocol);
 >     if (fd < 0) err(2, "socket");
 >=20
 >     if (bind(fd, r->ai_addr, r->ai_addrlen) < 0)
 >       err(2, "bind");
 >=20
 >     break;
 >   }
 >   freeaddrinfo(res);
 >=20
 >   /* non-existent host */
 >   hints.ai_flags =3D AI_NUMERICHOST;
 >   hints.ai_family =3D AF_INET6;
 >   hints.ai_socktype =3D SOCK_DGRAM;
 >   error =3D getaddrinfo("fc00::", "12345", &hints, &res);
 >   if (error) err(2, "getaddrinfo sendto");
 >=20
 >   /* send empty datagram */
 >   for (r =3D res; r; r =3D r->ai_next) {
 >     s =3D sendto(fd, "", 1, 0, r->ai_addr, r->ai_addrlen);
 >     if (s =3D=3D -1)
 >       err(2, "sendto");
 >     warnx("sent %zd bytes", s);
 >     break;
 >   }
 >   freeaddrinfo(res);
 >=20
 >   /* wait for events: sock will be readable and return EHOSTDOWN */
 >   while (1) {
 >     fds.fd =3D fd;
 >     fds.events =3D POLLIN;
 >     if (poll(&fds, 1, -1) =3D=3D 1) {
 >       warnx("events %d %d", fds.events, fds.revents);
 >=20
 >       /* do the equivalent of a libwarp "hostfrom" */
 >       len =3D sizeof(frominet);
 >       if (recvfrom(fd, buf, sizeof(buf), MSG_PEEK,
 >                    (struct sockaddr *)&frominet, &len) < 0) {
 >         warn("can't get client address");
 >       }
 >=20
 >       /* this blocks because the EHOSTDOWN was eaten above */
 >       s =3D recv(fd, buf, sizeof(buf), 0);
 >       warn("recv %zd", s);
 >     }
 >=20
 >     warnx("not reached :/");
 >   }
 >=20
 >   return 0;
 > }


 --Apple-Mail=_70E39BE3-8289-4A32-8D7B-CFC363B47D63
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/html;
 	charset=us-ascii

 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
 charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
 -webkit-nbsp-mode: space; line-break: after-white-space;" =
 class=3D"">Congratulations, you found a kernel bug. MSG_PEEK is not =
 supposed to reset so-&gt;so_{r,}error.<div class=3D"">Try this (not even =
 compile-tested).<br class=3D""><div class=3D""><br class=3D""></div><div =
 class=3D"">christos<br class=3D""><div class=3D""><br =
 class=3D""></div><div class=3D""><div class=3D"">diff -u -u -r1.281 =
 uipc_socket.c</div><div class=3D"">--- uipc_socket.c &nbsp; &nbsp; =
 &nbsp; 16 Jul 2019 22:57:55 -0000 &nbsp; &nbsp; &nbsp;1.281</div><div =
 class=3D"">+++ uipc_socket.c &nbsp; &nbsp; &nbsp; 14 Sep 2019 13:52:57 =
 -0000</div><div class=3D"">@@ -928,7 +928,8 @@</div><div class=3D"">&nbsp;=
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div =
 class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if =
 (so-&gt;so_error) {</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error =3D =
 so-&gt;so_error;</div><div class=3D"">- &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; so-&gt;so_error =3D =
 0;</div><div class=3D"">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((flags &amp; MSG_PEEK) =3D=3D =
 0)</div><div class=3D"">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 so-&gt;so_error =3D 0;</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goto =
 release;</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; }</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; if ((so-&gt;so_state &amp; SS_ISCONNECTED) =3D=3D =
 0) {</div><div class=3D"">@@ -1227,13 +1228,10 @@</div><div =
 class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if =
 (so-&gt;so_error || so-&gt;so_rerror) {</div><div class=3D"">&nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; if (m !=3D NULL)</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; goto dontblock;</div><div class=3D"">- &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if =
 (so-&gt;so_error) {</div><div class=3D"">- &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; error =3D so-&gt;so_error;</div><div class=3D"">- &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; so-&gt;so_error =3D 0;</div><div class=3D"">- =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; } else {</div><div class=3D"">- &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; error =3D so-&gt;so_rerror;</div><div class=3D"">- &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; so-&gt;so_rerror =3D 0;</div><div class=3D"">- =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; }</div><div class=3D"">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int *e =3D so-&gt;so_error ? =
 &amp;so-&gt;so_error : &amp;so-&gt;so_rerror;</div><div class=3D"">+ =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; error =3D *e;</div><div class=3D"">+ &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((flags &amp; =
 MSG_PEEK) =3D=3D 0)</div><div class=3D"">+ &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; *e =3D 0;</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goto release;</div><div =
 class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 }</div><div class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
 &nbsp; if (so-&gt;so_state &amp; SS_CANTRCVMORE) {</div><div =
 class=3D""><br class=3D""></div><div><br class=3D""><blockquote =
 type=3D"cite" class=3D""><div class=3D"">On Sep 14, 2019, at 9:40 AM, =
 Anthony Mallet &lt;<a href=3D"mailto:anthony.mallet@useless-ficus.net" =
 class=3D"">anthony.mallet@useless-ficus.net</a>&gt; wrote:</div><br =
 class=3D"Apple-interchange-newline"><div class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">#include =
 &lt;sys/socket.h&gt;</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">#include &lt;netinet/in.h&gt;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">#include &lt;err.h&gt;</span><br style=3D"caret-color: rgb(0, =
 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">#include &lt;event.h&gt;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">#include &lt;netdb.h&gt;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">#include &lt;poll.h&gt;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">int</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">main()</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">{</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;struct addrinfo hints =3D { 0 }, *res, =
 *r;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;struct sockaddr_storage frominet;</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;struct pollfd =
 fds;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;socklen_t len;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;char buf[16];</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;ssize_t s;</span><br style=3D"caret-color: rgb(0, =
 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;int error;</span><br style=3D"caret-color: rgb(0, =
 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;int fd;</span><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;/* setup sending socket */</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;hints.ai_flags =3D =
 AI_PASSIVE;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;hints.ai_family =3D AF_INET6;</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;hints.ai_socktype =3D =
 SOCK_DGRAM;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;error =3D getaddrinfo(NULL, "12345", &amp;hints, =
 &amp;res);</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" class=3D"">&nbsp;&nbsp;if =
 (error) err(2, "getaddrinfo bind");</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;for (r =3D res; r; r =3D r-&gt;ai_next) =
 {</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
 font-size: 12px; font-style: normal; font-variant-caps: normal; =
 font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;fd =3D socket(r-&gt;ai_family, =
 r-&gt;ai_socktype, r-&gt;ai_protocol);</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;if (fd &lt; 0) err(2, =
 "socket");</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;if (bind(fd, r-&gt;ai_addr, =
 r-&gt;ai_addrlen) &lt; 0)</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err(2, "bind");</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;break;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;}</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;freeaddrinfo(res);</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;/* non-existent host */</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;hints.ai_flags =3D =
 AI_NUMERICHOST;</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;hints.ai_family =3D AF_INET6;</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;hints.ai_socktype =3D =
 SOCK_DGRAM;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;error =3D getaddrinfo("fc00::", "12345", =
 &amp;hints, &amp;res);</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;if (error) err(2, "getaddrinfo =
 sendto");</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" class=3D"">&nbsp;&nbsp;/* =
 send empty datagram */</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;for (r =3D res; r; r =3D r-&gt;ai_next) =
 {</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
 font-size: 12px; font-style: normal; font-variant-caps: normal; =
 font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;s =3D sendto(fd, "", 1, 0, =
 r-&gt;ai_addr, r-&gt;ai_addrlen);</span><br style=3D"caret-color: rgb(0, =
 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;if (s =3D=3D -1)</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err(2, =
 "sendto");</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;warnx("sent %zd bytes", s);</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;break;</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;}</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;freeaddrinfo(res);</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;/* wait for events: sock will be readable and =
 return EHOSTDOWN */</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;while (1) {</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;fds.fd =3D fd;</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;fds.events=
  =3D POLLIN;</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;if (poll(&amp;fds, 1, -1) =3D=3D 1) =
 {</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
 font-size: 12px; font-style: normal; font-variant-caps: normal; =
 font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;warnx("events %d %d", =
 fds.events, fds.revents);</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* do the equivalent of a =
 libwarp "hostfrom" */</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len =3D =
 sizeof(frominet);</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (recvfrom(fd, buf, =
 sizeof(buf), MSG_PEEK,</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(struct sockaddr =
 *)&amp;frominet, &amp;len) &lt; 0) {</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;warn("can't =
 get client address");</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* this blocks because =
 the EHOSTDOWN was eaten above */</span><br style=3D"caret-color: rgb(0, =
 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s =3D recv(fd, buf, =
 sizeof(buf), 0);</span><br style=3D"caret-color: rgb(0, 0, 0); =
 font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;warn("recv %zd", =
 s);</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
 Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
 normal; font-weight: normal; letter-spacing: normal; text-align: start; =
 text-indent: 0px; text-transform: none; white-space: normal; =
 word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
 none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"caret-color: =
 rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
 normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
 normal; text-align: start; text-indent: 0px; text-transform: none; =
 white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, =
 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
 font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
 text-align: start; text-indent: 0px; text-transform: none; white-space: =
 normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
 text-decoration: none; float: none; display: inline !important;" =
 class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;warnx("not reached :/");</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;}</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">&nbsp;&nbsp;return 0;</span><br =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" =
 class=3D"">}</span></div></blockquote></div><br =
 class=3D""></div></div></div></body></html>=

 --Apple-Mail=_70E39BE3-8289-4A32-8D7B-CFC363B47D63--

From: Anthony Mallet <tho@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: Christos Zoulas <christos@zoulas.com>
    lib-bug-people@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: lib/54527: syslogd hangs when forwarding logs to a IPv6 host that
 is down
Date: Sat, 14 Sep 2019 19:43:29 +0200

 On Saturday 14 Sep 2019, at 09:55, Christos Zoulas wrote:
 > Congratulations, you found a kernel bug. MSG_PEEK is not supposed to
 > reset so->so_ {r,}error.  Try this (not even compile-tested).

 Ah, yes, it makes sense now that you say it ...
 Your patch works perfectly, thanks!

 Now syslogd logs "warning: can't get client address: Host is down"
 because of the warning in libwrap (src/lib/libwrap/socket.c:109). This
 is not really relevant in this case, since we are not really receiving
 a remote message, just a local sending error (and we will fail to
 recv(2) anyway). But it's a detail, I'm not sure it requires fixing :)

 (or maybe just warn if errno != EHOSTDOWN ?)

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 21 Apr 2020 19:45:49 +0000
State-Changed-Why:
I am closing the bug because the original problem is fixed (and is already in netbsd-9 as it predates the branch), but I'm not sure I understand the suggestion for warning changes... Thanks for the report!


From: maya@NetBSD.org
To: gnats-bugs@netbsd.org, anthony.mallet@useless-ficus.net
Cc: 
Subject: Re: lib/54527 (syslogd hangs when forwarding logs to a IPv6 host
 that is down)
Date: Tue, 21 Apr 2020 19:46:39 +0000

 I'm not sure, should the word 'client' be removed from the warning to
 avoid confusion if it's used for sending?

From: Anthony Mallet <tho@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: lib/54527 (syslogd hangs when forwarding logs to a IPv6 host
 that is down)
Date: Wed, 22 Apr 2020 12:09:38 +0200

 On Tuesday 21 Apr 2020, at 19:50, maya@NetBSD.org wrote:
 >  I'm not sure, should the word 'client' be removed from the warning to
 >  avoid confusion if it's used for sending?

 I think (IIRC) that what I was trying to say is that the messages are
 a bit noisy.

 When the host to which the sylog messages are forwarded is down, I get
 every 5s or so messages like this:
 Oct 31 11:47:21 cactus syslogd[2053]: recvfrom inet: Host is down
 Oct 31 11:47:21 cactus syslogd: warning: can't get client address: Host is down

 (I ended up disabling the forwarding in syslog.conf to avoid this pollution).

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.