Browse Source

remove the IPv4-only check for rdomains, allows IPv6 to use them

OK claudio@ henning@
OPENBSD_5_5
phessler 11 years ago
parent
commit
590be54dcd
3 changed files with 10 additions and 15 deletions
  1. +4
    -7
      src/usr.sbin/ntpd/client.c
  2. +3
    -5
      src/usr.sbin/ntpd/parse.y
  3. +3
    -3
      src/usr.sbin/ntpd/server.c

+ 4
- 7
src/usr.sbin/ntpd/client.c View File

@ -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> * 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) if (p->state < STATE_DNS_DONE || p->addr == NULL)
return (-1); return (-1);
if (p->addr->ss.ss_family != AF_INET && p->rtable != -1)
return (-1);
if (p->query->fd == -1) { if (p->query->fd == -1) {
struct sockaddr *sa = (struct sockaddr *)&p->addr->ss; struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;
@ -145,8 +142,8 @@ client_query(struct ntp_peer *p)
0)) == -1) 0)) == -1)
fatal("client_query socket"); 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) &p->rtable, sizeof(p->rtable)) == -1)
fatal("client_query setsockopt SO_RTABLE"); fatal("client_query setsockopt SO_RTABLE");
if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) { 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 && 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) sizeof(p->rtable)) == -1)
fatal("client_dispatch setsockopt SO_RTABLE"); fatal("client_dispatch setsockopt SO_RTABLE");


+ 3
- 5
src/usr.sbin/ntpd/parse.y View File

@ -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> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -162,8 +162,7 @@ main : LISTEN ON address listen_opts {
fatal(NULL); fatal(NULL);
if (p->addr != NULL) if (p->addr != NULL)
p->state = STATE_DNS_DONE; 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, TAILQ_INSERT_TAIL(&conf->ntp_peers,
p, entry); p, entry);
h = next; h = next;
@ -202,8 +201,7 @@ main : LISTEN ON address listen_opts {
fatal(NULL); fatal(NULL);
if (p->addr != NULL) if (p->addr != NULL)
p->state = STATE_DNS_DONE; 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); TAILQ_INSERT_TAIL(&conf->ntp_peers, p, entry);
free($2->name); free($2->name);
free($2); free($2);


+ 3
- 3
src/usr.sbin/ntpd/server.c View File

@ -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> * 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) IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
log_warn("setsockopt IPTOS_LOWDELAY"); 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) sizeof(la->rtable)) == -1)
fatal("setup_listeners setsockopt SO_RTABLE"); fatal("setup_listeners setsockopt SO_RTABLE");


Loading…
Cancel
Save