summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-10-09 22:52:19 +0000
committerbrian <brian@cvs.openbsd.org>2000-10-09 22:52:19 +0000
commit6831335e0e1d6c47d849e03055601bedf51e972f (patch)
tree15469e488e5e51bc6a174a94253f7355a3dc6ad2 /usr.sbin
parentb18b2a6e408cdbdd98318c681c2f91de934f472f (diff)
Don't exit when we get ENOBUFS from writev(), drop the packet instead.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pppoe/client.c6
-rw-r--r--usr.sbin/pppoe/common.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/pppoe/client.c b/usr.sbin/pppoe/client.c
index 46e91e9456b..084ef9e4201 100644
--- a/usr.sbin/pppoe/client.c
+++ b/usr.sbin/pppoe/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.4 2000/08/03 20:21:35 jason Exp $ */
+/* $OpenBSD: client.c,v 1.5 2000/10/09 22:52:18 brian Exp $ */
/*
* Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net
@@ -374,8 +374,10 @@ getpackets(bfd, srv, sysname, myea, rmea)
goto next;
if (pppfd < 0)
goto next;
- if (bpf_to_ppp(pppfd, len, mpkt) <= 0)
+ if ((r = bpf_to_ppp(pppfd, len, mpkt)) < 0)
return (-1);
+ if (r == 0)
+ continue;
}
next:
pkt += BPF_WORDALIGN(bh->bh_hdrlen + bh->bh_caplen);
diff --git a/usr.sbin/pppoe/common.c b/usr.sbin/pppoe/common.c
index e47537bbb0f..cb29c891d88 100644
--- a/usr.sbin/pppoe/common.c
+++ b/usr.sbin/pppoe/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.1 2000/06/18 07:30:41 jason Exp $ */
+/* $OpenBSD: common.c,v 1.2 2000/10/09 22:52:18 brian Exp $ */
/*
* Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net
@@ -139,7 +139,7 @@ bpf_to_ppp(pppfd, len, pkt)
r = writev(pppfd, iov, 2);
if (r < 0) {
- if (errno == EINTR || errno == EPIPE)
+ if (errno == EINTR || errno == EPIPE || errno == ENOBUFS)
return (0);
return (-1);
}
@@ -189,7 +189,9 @@ ppp_to_bpf(bfd, pppfd, myea, rmea, id)
iov[3].iov_base = &ph; iov[3].iov_len = sizeof(ph);
iov[4].iov_base = pktbuf; iov[4].iov_len = r;
- return (writev(bfd, iov, 5));
+ r = writev(bfd, iov, 5);
+
+ return (r == -1 && errno == ENOBUFS ? 0 : r);
}
void