aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>2001-08-03 16:51:53 +0000
committerBill Fenner <fenner@FreeBSD.org>2001-08-03 16:51:53 +0000
commit02e3112ae7cba65618d5e7bc756af02a22d30168 (patch)
treefdadbbf0b631495746fe5076a33953f52b2d8cbe
parent23254312160d03c5740d909d9781b2327b7fcfff (diff)
downloadsrc-02e3112ae7cba65618d5e7bc756af02a22d30168.tar.gz
src-02e3112ae7cba65618d5e7bc756af02a22d30168.zip
Don't terminate the uiomove() loop on a zero-length mbuf. It's not
particularly nice that IPSEC inserts a zero-length mbuf into the chain, and that bug should be fixed too, but interfaces should be robust to bad input. Print the interface name when TUNDEBUG()ing about dropping an mbuf.
Notes
Notes: svn path=/head/; revision=81106
-rw-r--r--sys/net/if_tun.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 68cef88f4373..e67a8ada235f 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -669,15 +669,14 @@ tunread(dev_t dev, struct uio *uio, int flag)
while (m0 && uio->uio_resid > 0 && error == 0) {
len = min(uio->uio_resid, m0->m_len);
- if (len == 0)
- break;
- error = uiomove(mtod(m0, caddr_t), len, uio);
+ if (len != 0)
+ error = uiomove(mtod(m0, caddr_t), len, uio);
MFREE(m0, m);
m0 = m;
}
if (m0) {
- TUNDEBUG("Dropping mbuf\n");
+ TUNDEBUG("%s%d: Dropping mbuf\n", ifp->if_name, ifp->if_unit);
m_freem(m0);
}
return error;