aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-10-28 13:52:14 +0000
committerMark Johnston <markj@FreeBSD.org>2024-10-28 15:14:36 +0000
commit01c738cd5c3938374cce8293c82753d977966154 (patch)
tree8fc64716a3b5472b7f3c8563bdacb6d4d89f4fcd
parent2bbfbf80d3bb828ac782c2d990a1fba0eb51e45a (diff)
downloadsrc-01c738cd5c39.tar.gz
src-01c738cd5c39.zip
if_tuntap: Enable MEXTPG support
Fix tunread() to use m_mbuftouio() instead of manually copying (which doesn't work for unmapped mbufs). Reviewed by: jhb, gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47295
-rw-r--r--sys/net/if_tuntap.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c
index 00ebc9546af6..f82480971b10 100644
--- a/sys/net/if_tuntap.c
+++ b/sys/net/if_tuntap.c
@@ -944,11 +944,11 @@ tuncreate(struct cdev *dev)
ifp->if_ioctl = tunifioctl;
ifp->if_flags = iflags;
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
- ifp->if_capabilities |= IFCAP_LINKSTATE;
+ ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_MEXTPG;
if ((tp->tun_flags & TUN_L2) != 0)
ifp->if_capabilities |=
IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO;
- ifp->if_capenable |= IFCAP_LINKSTATE;
+ ifp->if_capenable |= IFCAP_LINKSTATE | IFCAP_MEXTPG;
if ((tp->tun_flags & TUN_L2) != 0) {
ifp->if_init = tunifinit;
@@ -1728,18 +1728,9 @@ tunread(struct cdev *dev, struct uio *uio, int flag)
vhdr.hdr.csum_offset);
error = uiomove(&vhdr, len, uio);
}
-
- while (m && uio->uio_resid > 0 && error == 0) {
- len = min(uio->uio_resid, m->m_len);
- if (len != 0)
- error = uiomove(mtod(m, void *), len, uio);
- m = m_free(m);
- }
-
- if (m) {
- TUNDEBUG(ifp, "Dropping mbuf\n");
- m_freem(m);
- }
+ if (error == 0)
+ error = m_mbuftouio(uio, m, 0);
+ m_freem(m);
return (error);
}