summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2013-10-21 08:48:23 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2013-10-21 08:48:23 +0000
commit3757997eb8d479ae32b2c11ae8abd139439abf48 (patch)
treec6077f263c182df7de3bd145cc832fcfdf0dc35d /usr.sbin/ntpd
parentff140a4c92a3eacc5b39594204550c21b6044642 (diff)
remove the IPv4-only check for rdomains, allows IPv6 to use them
OK claudio@ henning@
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r--usr.sbin/ntpd/client.c11
-rw-r--r--usr.sbin/ntpd/parse.y8
-rw-r--r--usr.sbin/ntpd/server.c6
3 files changed, 10 insertions, 15 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c
index 65957691fd4..6d1fc43421c 100644
--- a/usr.sbin/ntpd/client.c
+++ b/usr.sbin/ntpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.91 2013/10/04 14:28:16 phessler Exp $ */
+/* $OpenBSD: client.c,v 1.92 2013/10/21 08:48:22 phessler Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -135,9 +135,6 @@ client_query(struct ntp_peer *p)
if (p->state < STATE_DNS_DONE || p->addr == NULL)
return (-1);
- if (p->addr->ss.ss_family != AF_INET && p->rtable != -1)
- return (-1);
-
if (p->query->fd == -1) {
struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;
@@ -145,8 +142,8 @@ client_query(struct ntp_peer *p)
0)) == -1)
fatal("client_query socket");
- if (p->addr->ss.ss_family == AF_INET && p->rtable != -1 &&
- setsockopt(p->query->fd, IPPROTO_IP, SO_RTABLE,
+ if (p->rtable != -1 &&
+ setsockopt(p->query->fd, SOL_SOCKET, SO_RTABLE,
&p->rtable, sizeof(p->rtable)) == -1)
fatal("client_query setsockopt SO_RTABLE");
if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) {
@@ -252,7 +249,7 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
}
if (p->rtable != -1 &&
- setsockopt(p->query->fd, IPPROTO_IP, SO_RTABLE, &p->rtable,
+ setsockopt(p->query->fd, SOL_SOCKET, SO_RTABLE, &p->rtable,
sizeof(p->rtable)) == -1)
fatal("client_dispatch setsockopt SO_RTABLE");
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y
index ee94a7b847c..9871d96f41e 100644
--- a/usr.sbin/ntpd/parse.y
+++ b/usr.sbin/ntpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.50 2012/09/20 12:43:16 patrick Exp $ */
+/* $OpenBSD: parse.y,v 1.51 2013/10/21 08:48:22 phessler Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -162,8 +162,7 @@ main : LISTEN ON address listen_opts {
fatal(NULL);
if (p->addr != NULL)
p->state = STATE_DNS_DONE;
- if (!(p->rtable > 0 && p->addr &&
- p->addr->ss.ss_family != AF_INET))
+ if (!(p->rtable > 0 && p->addr))
TAILQ_INSERT_TAIL(&conf->ntp_peers,
p, entry);
h = next;
@@ -202,8 +201,7 @@ main : LISTEN ON address listen_opts {
fatal(NULL);
if (p->addr != NULL)
p->state = STATE_DNS_DONE;
- if (!(p->rtable > 0 && p->addr &&
- p->addr->ss.ss_family != AF_INET))
+ if (!(p->rtable > 0 && p->addr))
TAILQ_INSERT_TAIL(&conf->ntp_peers, p, entry);
free($2->name);
free($2);
diff --git a/usr.sbin/ntpd/server.c b/usr.sbin/ntpd/server.c
index 754be380be8..f3d6185a58b 100644
--- a/usr.sbin/ntpd/server.c
+++ b/usr.sbin/ntpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.37 2013/04/30 11:42:56 mglocker Exp $ */
+/* $OpenBSD: server.c,v 1.38 2013/10/21 08:48:22 phessler Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -132,8 +132,8 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
log_warn("setsockopt IPTOS_LOWDELAY");
- if (la->sa.ss_family == AF_INET && la->rtable != -1 &&
- setsockopt(la->fd, IPPROTO_IP, SO_RTABLE, &la->rtable,
+ if (la->rtable != -1 &&
+ setsockopt(la->fd, SOL_SOCKET, SO_RTABLE, &la->rtable,
sizeof(la->rtable)) == -1)
fatal("setup_listeners setsockopt SO_RTABLE");