summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2004-10-14 09:35:49 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2004-10-14 09:35:49 +0000
commit96b74c54bf150f0e647296c3003a012c8e3e4672 (patch)
tree9e916b9d621fe6c2fe6424fb68541015b9e25d04 /usr.sbin
parent847f96280d44d4c3000df1dffb562acaceb5a588 (diff)
Have ntpd use IPTOS_LOWDELAY; ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ntpd/client.c7
-rw-r--r--usr.sbin/ntpd/ntpd.h4
-rw-r--r--usr.sbin/ntpd/server.c7
3 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c
index 230b3d7cf39..100e5de840c 100644
--- a/usr.sbin/ntpd/client.c
+++ b/usr.sbin/ntpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.40 2004/10/13 13:35:19 henning Exp $ */
+/* $OpenBSD: client.c,v 1.41 2004/10/14 09:35:48 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -112,6 +112,8 @@ client_nextaddr(struct ntp_peer *p)
int
client_query(struct ntp_peer *p)
{
+ int tos = IPTOS_LOWDELAY;
+
if (p->addr == NULL && client_nextaddr(p) == -1) {
set_next(p, INTERVAL_QUERY_PATHETIC);
return (-1);
@@ -131,6 +133,9 @@ client_query(struct ntp_peer *p)
} else
fatal("client_query connect");
}
+ if (setsockopt(p->query->fd, IPPROTO_IP, IP_TOS, &tos,
+ sizeof(tos)) == -1)
+ log_warn("setsockopt IPTOS_LOWDELAY");
}
/*
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index ac4cb360b91..0102f4c1bb9 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.39 2004/09/18 20:27:57 henning Exp $ */
+/* $OpenBSD: ntpd.h,v 1.40 2004/10/14 09:35:48 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -21,6 +21,8 @@
#include <sys/socket.h>
#include <sys/queue.h>
#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdarg.h>
diff --git a/usr.sbin/ntpd/server.c b/usr.sbin/ntpd/server.c
index 28574e6eb17..1d8e4d58932 100644
--- a/usr.sbin/ntpd/server.c
+++ b/usr.sbin/ntpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.15 2004/10/13 14:02:50 henning Exp $ */
+/* $OpenBSD: server.c,v 1.16 2004/10/14 09:35:48 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -35,6 +35,7 @@ setup_listeners(struct servent *se, struct ntpd_conf *conf, u_int *cnt)
struct ifaddrs *ifap;
struct sockaddr *sa;
u_int new_cnt = 0;
+ int tos = IPTOS_LOWDELAY;
if (conf->listen_all) {
if (getifaddrs(&ifap) == -1)
@@ -82,6 +83,10 @@ setup_listeners(struct servent *se, struct ntpd_conf *conf, u_int *cnt)
if ((la->fd = socket(la->sa.ss_family, SOCK_DGRAM, 0)) == -1)
fatal("socket");
+ if (setsockopt(la->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))
+ == -1)
+ log_warn("setsockopt IPTOS_LOWDELAY");
+
if (bind(la->fd, (struct sockaddr *)&la->sa,
SA_LEN((struct sockaddr *)&la->sa)) == -1)
fatal("bind");