git: e6f9f493a827 - stable/14 - if_tuntap: Enable MEXTPG support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Nov 2024 14:09:11 UTC
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6f9f493a827bb900e324d6790ea0ff465018ee3 commit e6f9f493a827bb900e324d6790ea0ff465018ee3 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-10-28 13:52:14 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-11-11 14:02:30 +0000 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 (cherry picked from commit 01c738cd5c3938374cce8293c82753d977966154) --- sys/net/if_tuntap.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 54d1908b078c..0dee2260973d 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -976,11 +976,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; @@ -1760,18 +1760,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); }