From 7a3b9e1c6e340a8cfcb29cbac1ad4739a43e4929 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:10:22 -0600 Subject: [PATCH 01/13] Handle IPv6 DNS records on IPv4 networks more liberally Rather than fail on IPv4 only networks when seeing an IPv6 DNS record, just give a warning. Debian bug ID: 500676. Original Author: Stefan Praszalowicz --- src/usr.sbin/ntpd/client.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c index 3de52685b..aa9fc24c6 100644 --- a/src/usr.sbin/ntpd/client.c +++ b/src/usr.sbin/ntpd/client.c @@ -140,9 +140,16 @@ client_query(struct ntp_peer *p) struct sockaddr *qa4 = (struct sockaddr *)&p->query_addr4; struct sockaddr *qa6 = (struct sockaddr *)&p->query_addr6; - if ((p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM, - 0)) == -1) - fatal("client_query socket"); + p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM, 0); + if (p->query->fd == -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 (p->addr->ss.ss_family == qa4->sa_family) { if (bind(p->query->fd, qa4, SA_LEN(qa4)) == -1) -- 2.13.0