Hi,

We have this problem as well; it makes openntp almost unusable in our setup.

Here's a relatively trivial patch that seems to work for us  (only
tested for a day though).

When a socket() error happens, look at errno for the following error
(from socket(2)):
       EAFNOSUPPORT The implementation does not support the specified
address family.
For this error behave like we do on connect() errors (copying some
code which happens to be just a few lines below). Log a warning
message.
For other errors we still die (calling fatal).

Here's a stupid log extract which shows it working (some peers cause
the warning message to be shown but openntpd doesn't stop and
eventually the clock is synced):
 Jan  8 12:45:41 osso ntpd[25168]: client_query socket: Address family
not supported by protocol
 Jan  8 12:55:56 osso ntpd[25168]: client_query socket: Address family
not supported by protocol
 Jan  8 13:13:02 osso ntpd[25168]: clock is now synced
 Jan  8 13:17:06 osso ntpd[25168]: client_query socket: Address family
not supported by protocol

Please consider this patch, I'm happy to make corrections or do more
tests if needed.
Also, I was not sure if I should attach it or just paste, please let
me know if I need to re-send.

Regards,
Stefan


--- openntpd-3.9p1/client.c     2009-01-08 10:47:49.000000000 +0100
+++ openntpd-3.9p1-noipv6/client.c      2009-01-08 18:14:32.000000000 +0100
@@ -130,8 +130,20 @@
                struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;

                if ((p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM,
-                   0)) == -1)
+                   0)) == -1) {
+               
+                  if (errno == EAFNOSUPPORT) {
+                     log_warn("client_query socket");
+                     client_nextaddr(p);
+                     set_next(p, error_interval());
+                     return (-1);
+                  }
+                  else
+                  {
                        fatal("client_query socket");
+                  }
+                }
+
                if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) {
                        if (errno == ECONNREFUSED || errno == ENETUNREACH ||
                            errno == EHOSTUNREACH) {



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to