Browse Source

Have ntpd use IPTOS_LOWDELAY; ok henning@

OPENBSD_3_7
dtucker 20 years ago
parent
commit
dcc316e5a2
3 changed files with 15 additions and 3 deletions
  1. +6
    -1
      src/usr.sbin/ntpd/client.c
  2. +3
    -1
      src/usr.sbin/ntpd/ntpd.h
  3. +6
    -1
      src/usr.sbin/ntpd/server.c

+ 6
- 1
src/usr.sbin/ntpd/client.c View File

@ -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> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -112,6 +112,8 @@ client_nextaddr(struct ntp_peer *p)
int int
client_query(struct ntp_peer *p) client_query(struct ntp_peer *p)
{ {
int tos = IPTOS_LOWDELAY;
if (p->addr == NULL && client_nextaddr(p) == -1) { if (p->addr == NULL && client_nextaddr(p) == -1) {
set_next(p, INTERVAL_QUERY_PATHETIC); set_next(p, INTERVAL_QUERY_PATHETIC);
return (-1); return (-1);
@ -131,6 +133,9 @@ client_query(struct ntp_peer *p)
} else } else
fatal("client_query connect"); fatal("client_query connect");
} }
if (setsockopt(p->query->fd, IPPROTO_IP, IP_TOS, &tos,
sizeof(tos)) == -1)
log_warn("setsockopt IPTOS_LOWDELAY");
} }
/* /*


+ 3
- 1
src/usr.sbin/ntpd/ntpd.h View File

@ -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> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -21,6 +21,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <stdarg.h> #include <stdarg.h>


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

@ -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> * 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 ifaddrs *ifap;
struct sockaddr *sa; struct sockaddr *sa;
u_int new_cnt = 0; u_int new_cnt = 0;
int tos = IPTOS_LOWDELAY;
if (conf->listen_all) { if (conf->listen_all) {
if (getifaddrs(&ifap) == -1) 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) if ((la->fd = socket(la->sa.ss_family, SOCK_DGRAM, 0)) == -1)
fatal("socket"); 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, if (bind(la->fd, (struct sockaddr *)&la->sa,
SA_LEN((struct sockaddr *)&la->sa)) == -1) SA_LEN((struct sockaddr *)&la->sa)) == -1)
fatal("bind"); fatal("bind");


Loading…
Cancel
Save