diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c index 4ce0f19a..e99ff71e 100644 --- a/src/usr.sbin/ntpd/client.c +++ b/src/usr.sbin/ntpd/client.c @@ -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 @@ -133,8 +133,15 @@ client_dispatch(struct ntp_peer *p) fsa_len = sizeof(fsa); 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(); diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c index 25fdb861..fc1525e5 100644 --- a/src/usr.sbin/ntpd/server.c +++ b/src/usr.sbin/ntpd/server.c @@ -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 @@ -105,8 +105,15 @@ server_dispatch(int fd, struct ntpd_conf *conf) fsa_len = sizeof(fsa); 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();