summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-06-23 06:59:55 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-06-23 06:59:55 +0000
commit32af7c981e230597b3a25094306ae43e423c52e1 (patch)
tree6203b0328f08ab24a30b302cc321a2fe3fbf6adf /usr.sbin
parenta8d20b97e8d6df41abd6bf29d726c0aa1dd43373 (diff)
Fix the problem when npppd receives a zero length 1701/udp packet. If
it receives such packets when the errno is not EAGAIN or EINTR, it had closed all L2TP sessions and stoppped the L2TP server. Also fix the receiving GRE packet since it potentially has the same problem.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/npppd/l2tp/l2tpd.c6
-rw-r--r--usr.sbin/npppd/pptp/pptpd.c11
2 files changed, 8 insertions, 9 deletions
diff --git a/usr.sbin/npppd/l2tp/l2tpd.c b/usr.sbin/npppd/l2tp/l2tpd.c
index f1e9d74a9d6..664fd944aa7 100644
--- a/usr.sbin/npppd/l2tp/l2tpd.c
+++ b/usr.sbin/npppd/l2tp/l2tpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tpd.c,v 1.15 2014/05/07 01:16:15 tedu Exp $ */
+/* $OpenBSD: l2tpd.c,v 1.16 2015/06/23 06:59:54 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file L2TP(Layer Two Tunneling Protocol "L2TP") / RFC2661 */
-/* $Id: l2tpd.c,v 1.15 2014/05/07 01:16:15 tedu Exp $ */
+/* $Id: l2tpd.c,v 1.16 2015/06/23 06:59:54 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -632,7 +632,7 @@ l2tpd_io_event(int fd, short evtype, void *ctx)
if ((sz = recvfromto(_this->sock, buf,
sizeof(buf), 0,
(struct sockaddr *)&peer, &peerlen,
- (struct sockaddr *)&sock, &socklen)) <= 0) {
+ (struct sockaddr *)&sock, &socklen)) == -1) {
#endif
if (errno == EAGAIN || errno == EINTR)
break;
diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c
index 489ba324d09..61b92a7bc89 100644
--- a/usr.sbin/npppd/pptp/pptpd.c
+++ b/usr.sbin/npppd/pptp/pptpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $ */
+/* $OpenBSD: pptpd.c,v 1.26 2015/06/23 06:59:54 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.25 2015/01/19 01:48:59 deraadt Exp $ */
+/* $Id: pptpd.c,v 1.26 2015/06/23 06:59:54 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.25 2015/01/19 01:48:59 deraadt Exp $
+ * $Id: pptpd.c,v 1.26 2015/06/23 06:59:54 yasuoka Exp $
*/
#include <sys/types.h>
#include <sys/socket.h>
@@ -674,9 +674,8 @@ pptpd_gre_io_event(int fd, short evmask, void *ctx)
/* read till bloked */
peerlen = sizeof(peer);
if ((sz = recvfrom(listener->sock_gre, pkt, sizeof(pkt),
- 0, (struct sockaddr *)&peer, &peerlen)) <= 0) {
- if (sz < 0 &&
- (errno == EAGAIN || errno == EINTR))
+ 0, (struct sockaddr *)&peer, &peerlen)) == -1) {
+ if (errno == EAGAIN || errno == EINTR)
break;
pptpd_log(_this, LOG_INFO,
"read(GRE) failed: %m");