diff options
author | 2014-07-10 13:48:03 +0000 | |
---|---|---|
committer | 2014-07-10 13:48:03 +0000 | |
commit | d49e4bc49eba70420544e8759cfc47558e0b0e97 (patch) | |
tree | 2a3d97b6da892a2eb82d3a9f509a4d1d699e3652 | |
parent | __tfork_thread is in libc, so move the manpage over too (diff) | |
download | wireguard-openbsd-d49e4bc49eba70420544e8759cfc47558e0b0e97.tar.xz wireguard-openbsd-d49e4bc49eba70420544e8759cfc47558e0b0e97.zip |
Tweak accept pacing in pptp. Add handling when accept_add() fails and
add logging when accept() fails in EMFILE or ENFILE.
-rw-r--r-- | usr.sbin/npppd/pptp/pptpd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c index acf5e9af5ba..ae33e2a2769 100644 --- a/usr.sbin/npppd/pptp/pptpd.c +++ b/usr.sbin/npppd/pptp/pptpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pptpd.c,v 1.22 2014/05/30 05:06:00 yasuoka Exp $ */ +/* $OpenBSD: pptpd.c,v 1.23 2014/07/10 13:48:03 yasuoka 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.22 2014/05/30 05:06:00 yasuoka Exp $ */ +/* $Id: pptpd.c,v 1.23 2014/07/10 13:48:03 yasuoka 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.22 2014/05/30 05:06:00 yasuoka Exp $ + * $Id: pptpd.c,v 1.23 2014/07/10 13:48:03 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> @@ -401,7 +401,11 @@ pptpd_listener_start(pptpd_listener *_this) _this->sock = sock; _this->sock_gre = sock_gre; - accept_add(_this->sock, pptpd_io_event, _this); + if (accept_add(_this->sock, pptpd_io_event, _this) != 0) { + pptpd_log(_this->self, LOG_ERR, + "accept_add() failed in %s(): %m", __func__); + goto fail; + } event_set(&_this->ev_sock_gre, _this->sock_gre, EV_READ | EV_PERSIST, pptpd_gre_io_event, _this); @@ -625,10 +629,10 @@ pptpd_io_event(int fd, short evmask, void *ctx) peerlen = sizeof(peer); if ((newsock = accept(listener->sock, (struct sockaddr *)&peer, &peerlen)) < 0) { - if (errno == EMFILE || errno == ENFILE) - accept_pause(); - else if (errno != EAGAIN && errno != EINTR && + if (errno != EAGAIN && errno == EINTR && errno != ECONNABORTED) { + if (errno == EMFILE || errno == ENFILE) + accept_pause(); pptpd_log(_this, LOG_ERR, "accept() failed at %s(): %m", __func__); |