summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-03-11 17:40:09 +0000
committerderaadt <deraadt@openbsd.org>2013-03-11 17:40:09 +0000
commit62e3c2528255beec34fe0acd77e74b042a0926c6 (patch)
tree1c7e4070f2f682e9d9017be26794ca4197437d0e /usr.sbin
parentWhen binding a lease, check for and clear out any 'zombie' routes (diff)
downloadwireguard-openbsd-62e3c2528255beec34fe0acd77e74b042a0926c6.tar.xz
wireguard-openbsd-62e3c2528255beec34fe0acd77e74b042a0926c6.zip
handle ECONNABORTED errors from accept(). In many code blocks they can be
ignored silently and without aborting, much like EINTR and EWOULDBLOCK are. ok's from various maintainers of these directories...
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/control.c5
-rw-r--r--usr.sbin/bgpd/session.c11
-rw-r--r--usr.sbin/dvmrpd/control.c5
-rw-r--r--usr.sbin/ftp-proxy/ftp-proxy.c6
-rw-r--r--usr.sbin/inetd/inetd.c9
-rw-r--r--usr.sbin/iscsid/control.c5
-rw-r--r--usr.sbin/ldpd/control.c5
-rw-r--r--usr.sbin/ldpd/packet.c5
-rw-r--r--usr.sbin/lpr/lpd/lpd.c5
-rw-r--r--usr.sbin/npppd/pptp/pptpd.c9
-rw-r--r--usr.sbin/ospf6d/control.c5
-rw-r--r--usr.sbin/ospfd/control.c5
-rw-r--r--usr.sbin/ppp/ppp/server.c10
-rw-r--r--usr.sbin/relayd/control.c5
-rw-r--r--usr.sbin/ripd/control.c5
-rw-r--r--usr.sbin/sasyncd/net.c5
-rw-r--r--usr.sbin/smtpd/control.c5
-rw-r--r--usr.sbin/smtpd/smtp.c5
-rw-r--r--usr.sbin/snmpd/control.c5
-rw-r--r--usr.sbin/syslogd/syslogd.c5
20 files changed, 70 insertions, 50 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index 37e67bb280e..47b8b45fb6b 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.73 2013/03/07 21:26:28 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.74 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -125,7 +125,8 @@ control_accept(int listenfd, int restricted)
if (errno == ENFILE || errno == EMFILE) {
pauseaccept = getmonotime();
return (0);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return (0);
}
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index ae8d7a503bb..1218c5019f9 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.327 2013/03/07 21:26:28 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.328 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -1037,13 +1037,12 @@ session_accept(int listenfd)
len = sizeof(cliaddr);
if ((connfd = accept(listenfd,
(struct sockaddr *)&cliaddr, &len)) == -1) {
- if (errno == ENFILE || errno == EMFILE) {
+ if (errno == ENFILE || errno == EMFILE)
pauseaccept = getmonotime();
- return;
- } else if (errno == EWOULDBLOCK || errno == EINTR)
- return;
- else
+ else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("accept");
+ return;
}
p = getpeerbyip((struct sockaddr *)&cliaddr);
diff --git a/usr.sbin/dvmrpd/control.c b/usr.sbin/dvmrpd/control.c
index 7d3fd7dc37f..c3cbde4050f 100644
--- a/usr.sbin/dvmrpd/control.c
+++ b/usr.sbin/dvmrpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.16 2012/04/11 08:34:41 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.17 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -134,7 +134,8 @@ control_accept(int listenfd, short event, void *bula)
event_del(&control_state.ev);
evtimer_add(&control_state.evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/ftp-proxy/ftp-proxy.c b/usr.sbin/ftp-proxy/ftp-proxy.c
index 38a81e3f707..936ba06c106 100644
--- a/usr.sbin/ftp-proxy/ftp-proxy.c
+++ b/usr.sbin/ftp-proxy/ftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp-proxy.c,v 1.26 2013/03/10 21:28:26 benno Exp $ */
+/* $OpenBSD: ftp-proxy.c,v 1.27 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -435,7 +435,9 @@ handle_connection(const int listen_fd, short event, void *arg)
event_del(&listen_ev);
evtimer_add(&pause_accept_ev, &pause);
- }
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
+ logmsg(LOG_CRIT, "accept() failed: %s", strerror(errno));
return;
}
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 765709616b6..92639260eba 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.133 2012/04/19 14:33:24 gsoares Exp $ */
+/* $OpenBSD: inetd.c,v 1.134 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -496,9 +496,10 @@ gettcp(struct servtab *sep)
if (debug)
fprintf(stderr, "accept, ctrl %d\n", ctrl);
if (ctrl < 0) {
- if (errno == EINTR)
- return -1;
- syslog(LOG_WARNING, "accept (for %s): %m", sep->se_service);
+ if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
+ syslog(LOG_WARNING, "accept (for %s): %m",
+ sep->se_service);
return -1;
}
if ((sep->se_family == AF_INET || sep->se_family == AF_INET6) &&
diff --git a/usr.sbin/iscsid/control.c b/usr.sbin/iscsid/control.c
index 1621a576339..ba75afa31e3 100644
--- a/usr.sbin/iscsid/control.c
+++ b/usr.sbin/iscsid/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.3 2012/04/11 08:16:37 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.4 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -165,7 +165,8 @@ control_accept(int listenfd, short event, void *bula)
event_del(&control_state->ev);
evtimer_add(&control_state->evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept");
return;
}
diff --git a/usr.sbin/ldpd/control.c b/usr.sbin/ldpd/control.c
index 5a14a802977..7b6aa47dcea 100644
--- a/usr.sbin/ldpd/control.c
+++ b/usr.sbin/ldpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.10 2012/04/12 17:33:43 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.11 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -120,7 +120,8 @@ control_accept(int listenfd, short event, void *bula)
*/
if (errno == ENFILE || errno == EMFILE)
accept_pause();
- else if (errno != EWOULDBLOCK && errno != EINTR)
+ else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c
index 5a5880d162f..1d3ca1ff953 100644
--- a/usr.sbin/ldpd/packet.c
+++ b/usr.sbin/ldpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.16 2012/04/12 17:33:43 claudio Exp $ */
+/* $OpenBSD: packet.c,v 1.17 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -268,7 +268,8 @@ session_accept(int fd, short event, void *bula)
*/
if (errno == ENFILE || errno == EMFILE) {
accept_pause();
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_debug("sess_recv_packet: accept error: %s",
strerror(errno));
return;
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index 9995eb222ad..076bc806e84 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.50 2009/10/27 23:59:52 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.51 2013/03/11 17:40:11 deraadt Exp $ */
/* $NetBSD: lpd.c,v 1.33 2002/01/21 14:42:29 wiz Exp $ */
/*
@@ -387,7 +387,8 @@ main(int argc, char **argv)
}
}
if (s < 0) {
- if (errno != EINTR)
+ if (errno != EINTR && errno != EWOULDBLOCK &&
+ errno != ECONNABORTED)
syslog(LOG_WARNING, "accept: %m");
continue;
}
diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c
index 4682d175492..e6a407697bc 100644
--- a/usr.sbin/npppd/pptp/pptpd.c
+++ b/usr.sbin/npppd/pptp/pptpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptpd.c,v 1.13 2013/03/11 09:28:02 giovanni Exp $ */
+/* $OpenBSD: pptpd.c,v 1.14 2013/03/11 17:40:11 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,12 +25,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptpd.c,v 1.13 2013/03/11 09:28:02 giovanni Exp $ */
+/* $Id: pptpd.c,v 1.14 2013/03/11 17:40:11 deraadt Exp $ */
/**@file
* This file provides a implementation of PPTP daemon. Currently it
* provides functions for PAC (PPTP Access Concentrator) only.
- * $Id: pptpd.c,v 1.13 2013/03/11 09:28:02 giovanni Exp $
+ * $Id: pptpd.c,v 1.14 2013/03/11 17:40:11 deraadt Exp $
*/
#include <sys/types.h>
#include <sys/param.h>
@@ -646,7 +646,8 @@ pptpd_io_event(int fd, short evmask, void *ctx)
(struct sockaddr *)&peer, &peerlen)) < 0) {
if (errno == EMFILE || errno == ENFILE)
accept_pause();
- else if (errno != EAGAIN && errno != EINTR) {
+ else if (errno != EAGAIN && errno != EINTR &&
+ errno != ECONNABORTED) {
pptpd_log(_this, LOG_ERR,
"accept() failed at %s(): %m",
__func__);
diff --git a/usr.sbin/ospf6d/control.c b/usr.sbin/ospf6d/control.c
index 4bf2c4be8e2..5404373cfb1 100644
--- a/usr.sbin/ospf6d/control.c
+++ b/usr.sbin/ospf6d/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.18 2012/04/11 08:33:53 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.19 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -132,7 +132,8 @@ control_accept(int listenfd, short event, void *bula)
event_del(&control_state.ev);
evtimer_add(&control_state.evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c
index a5d75a4bd34..35d9c1f3359 100644
--- a/usr.sbin/ospfd/control.c
+++ b/usr.sbin/ospfd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.37 2012/04/11 08:33:53 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.38 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -135,7 +135,8 @@ control_accept(int listenfd, short event, void *bula)
event_del(&control_state.ev);
evtimer_add(&control_state.evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/ppp/ppp/server.c b/usr.sbin/ppp/ppp/server.c
index 38705261ba3..65f2b96f387 100644
--- a/usr.sbin/ppp/ppp/server.c
+++ b/usr.sbin/ppp/ppp/server.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: server.c,v 1.18 2006/09/25 05:59:28 otto Exp $
+ * $OpenBSD: server.c,v 1.19 2013/03/11 17:40:11 deraadt Exp $
*/
#include <sys/param.h>
@@ -101,9 +101,11 @@ server_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset)
if (s->fd >= 0 && FD_ISSET(s->fd, fdset)) {
wfd = accept(s->fd, sa, &ssize);
- if (wfd < 0)
- log_Printf(LogERROR, "server_Read: accept(): %s\n", strerror(errno));
- else if (sa->sa_len == 0) {
+ if (wfd < 0) {
+ if (errno != EINTR && errno != EWOULDBLOCK &&
+ errno != ECONNABORTED)
+ log_Printf(LogERROR, "server_Read: accept(): %s\n", strerror(errno));
+ } else if (sa->sa_len == 0) {
close(wfd);
wfd = -1;
}
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 275dd925713..e3046f1a7e6 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.43 2012/04/19 14:48:44 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.44 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -159,7 +159,8 @@ control_accept(int listenfd, short event, void *arg)
event_del(&cs->cs_ev);
evtimer_add(&cs->cs_evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("%s: accept", __func__);
return;
}
diff --git a/usr.sbin/ripd/control.c b/usr.sbin/ripd/control.c
index 2cc7bf596b3..013192517f3 100644
--- a/usr.sbin/ripd/control.c
+++ b/usr.sbin/ripd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.17 2012/04/11 08:33:53 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.18 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -133,7 +133,8 @@ control_accept(int listenfd, short event, void *bula)
event_del(&control_state.ev);
evtimer_add(&control_state.evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/sasyncd/net.c b/usr.sbin/sasyncd/net.c
index 911b7cd1e3d..9f6e15bc58e 100644
--- a/usr.sbin/sasyncd/net.c
+++ b/usr.sbin/sasyncd/net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: net.c,v 1.19 2012/04/15 03:25:27 jsg Exp $ */
+/* $OpenBSD: net.c,v 1.20 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -511,7 +511,8 @@ net_accept(int accept_socket)
"socket, closing.");
close(s);
}
- } else
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_err("net: accept()");
}
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index a697ee7a489..b28bba91325 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.82 2013/01/26 09:37:23 gilles Exp $ */
+/* $OpenBSD: control.c,v 1.83 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
@@ -308,7 +308,8 @@ control_accept(int listenfd, short event, void *arg)
if ((connfd = accept(listenfd, (struct sockaddr *)&sun, &len)) == -1) {
if (errno == ENFILE || errno == EMFILE)
goto pause;
- if (errno == EINTR || errno == ECONNABORTED)
+ if (errno == EINTR || errno == EWOULDBLOCK ||
+ errno == ECONNABORTED)
return;
fatal("control_accept: accept");
}
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 635c1b32e7d..0874c38b272 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.123 2013/01/26 09:37:23 gilles Exp $ */
+/* $OpenBSD: smtp.c,v 1.124 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -418,7 +418,8 @@ smtp_accept(int fd, short event, void *p)
log_warn("warn: Disabling incoming SMTP connections");
goto pause;
}
- if (errno == EINTR || errno == ECONNABORTED)
+ if (errno == EINTR || errno == EWOULDBLOCK ||
+ errno == ECONNABORTED)
return;
fatal("smtp_accept");
}
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c
index 29cba914e62..f508d6bf56b 100644
--- a/usr.sbin/snmpd/control.c
+++ b/usr.sbin/snmpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.17 2012/11/29 14:53:24 yasuoka Exp $ */
+/* $OpenBSD: control.c,v 1.18 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -157,7 +157,8 @@ control_accept(int listenfd, short event, void *arg)
event_del(&cs->cs_ev);
evtimer_add(&cs->cs_evt, &evtpause);
- } else if (errno != EWOULDBLOCK && errno != EINTR)
+ } else if (errno != EWOULDBLOCK && errno != EINTR &&
+ errno != ECONNABORTED)
log_warn("control_accept: accept");
return;
}
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index d9ad7c72f8e..175a52a337c 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.105 2013/02/10 10:47:08 markus Exp $ */
+/* $OpenBSD: syslogd.c,v 1.106 2013/03/11 17:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -1805,7 +1805,8 @@ ctlsock_accept_handler(void)
dprintf("Accepting control connection\n");
fd = accept(pfd[PFD_CTLSOCK].fd, NULL, NULL);
if (fd == -1) {
- if (errno != EINTR && errno != ECONNABORTED)
+ if (errno != EINTR && errno != EWOULDBLOCK &&
+ errno != ECONNABORTED)
logerror("accept ctlsock");
return;
}