summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2001-08-02 22:30:41 +0000
committeritojun <itojun@openbsd.org>2001-08-02 22:30:41 +0000
commit791b4bf6c9ae0bab2bc676c54dc89d2aeed2e684 (patch)
treed774c4cede0c4db511d72b6cbde7a201d8535e60
parentassure -> ensure (diff)
downloadwireguard-openbsd-791b4bf6c9ae0bab2bc676c54dc89d2aeed2e684.tar.xz
wireguard-openbsd-791b4bf6c9ae0bab2bc676c54dc89d2aeed2e684.zip
do not exit loop even if m_len == 0. it is legal to have an mbuf with
m_len == 0 in mbuf chain.
-rw-r--r--sys/net/if_tun.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index e93689d2b8b..3050cbd6a66 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.36 2001/06/27 06:07:46 kjc Exp $ */
+/* $OpenBSD: if_tun.c,v 1.37 2001/08/02 22:30:41 itojun Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -534,6 +534,11 @@ tunread(dev, uio, ioflag)
splx(s);
while (m0 && uio->uio_resid > 0 && error == 0) {
+ if (m0->m_len == 0) {
+ MFREE(m0, m);
+ m0 = m;
+ continue;
+ }
len = min(uio->uio_resid, m0->m_len);
if (len == 0)
break;