The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=01c738cd5c3938374cce8293c82753d977966154

commit 01c738cd5c3938374cce8293c82753d977966154
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2024-10-28 13:52:14 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2024-10-28 15:14:36 +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
---
 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 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);
 }
 

Reply via email to