Browse Source

there are a few recvfrom(2) errors we do not want to panic on

OPENBSD_3_6
henning 20 years ago
parent
commit
7253f8812f
2 changed files with 20 additions and 6 deletions
  1. +10
    -3
      src/usr.sbin/ntpd/client.c
  2. +10
    -3
      src/usr.sbin/ntpd/server.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.26 2004/07/18 12:59:41 henning Exp $ */
/* $OpenBSD: client.c,v 1.27 2004/07/18 13:26:53 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -133,8 +133,15 @@ client_dispatch(struct ntp_peer *p)
fsa_len = sizeof(fsa); fsa_len = sizeof(fsa);
if ((size = recvfrom(p->query->fd, &buf, sizeof(buf), 0, if ((size = recvfrom(p->query->fd, &buf, sizeof(buf), 0,
(struct sockaddr *)&fsa, &fsa_len)) == -1)
fatal("recvfrom");
(struct sockaddr *)&fsa, &fsa_len)) == -1) {
if (errno == EHOSTUNREACH || errno == EHOSTDOWN ||
errno == ENETDOWN) {
log_warn("recvfrom %s",
log_sockaddr((struct sockaddr *)&fsa));
return (0);
} else
fatal("recvfrom");
}
T4 = gettime(); T4 = gettime();


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

@ -1,4 +1,4 @@
/* $OpenBSD: server.c,v 1.11 2004/07/14 20:16:31 henning Exp $ */
/* $OpenBSD: server.c,v 1.12 2004/07/18 13:26:53 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -105,8 +105,15 @@ server_dispatch(int fd, struct ntpd_conf *conf)
fsa_len = sizeof(fsa); fsa_len = sizeof(fsa);
if ((size = recvfrom(fd, &buf, sizeof(buf), 0, if ((size = recvfrom(fd, &buf, sizeof(buf), 0,
(struct sockaddr *)&fsa, &fsa_len)) == -1)
fatal("recvfrom");
(struct sockaddr *)&fsa, &fsa_len)) == -1) {
if (errno == EHOSTUNREACH || errno == EHOSTDOWN ||
errno == ENETDOWN) {
log_warn("recvfrom %s",
log_sockaddr((struct sockaddr *)&fsa));
return (0);
} else
fatal("recvfrom");
}
rectime = gettime(); rectime = gettime();


Loading…
Cancel
Save