From 96b74c54bf150f0e647296c3003a012c8e3e4672 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 14 Oct 2004 09:35:49 +0000 Subject: Have ntpd use IPTOS_LOWDELAY; ok henning@ --- usr.sbin/ntpd/client.c | 7 ++++++- usr.sbin/ntpd/ntpd.h | 4 +++- usr.sbin/ntpd/server.c | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'usr.sbin') 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 @@ -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 @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include #include 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 @@ -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"); -- cgit v1.2.3