|
@ -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"); |
|
|