svn commit: r300205 - head/sys/net

Michael Tuexen tuexen at FreeBSD.org
Thu May 19 13:52:14 UTC 2016


Author: tuexen
Date: Thu May 19 13:52:12 2016
New Revision: 300205
URL: https://svnweb.freebsd.org/changeset/base/300205

Log:
  Allow writing IP packets of length TUNMRU no matter if TUNSIFHEAD is set
  or not.

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==============================================================================
--- head/sys/net/if_tun.c	Thu May 19 13:32:44 2016	(r300204)
+++ head/sys/net/if_tun.c	Thu May 19 13:52:12 2016	(r300205)
@@ -848,7 +848,7 @@ tunwrite(struct cdev *dev, struct uio *u
 	struct tun_softc *tp = dev->si_drv1;
 	struct ifnet	*ifp = TUN2IFP(tp);
 	struct mbuf	*m;
-	uint32_t	family;
+	uint32_t	family, mru;
 	int 		isr;
 
 	TUNDEBUG(ifp, "tunwrite\n");
@@ -860,7 +860,10 @@ tunwrite(struct cdev *dev, struct uio *u
 	if (uio->uio_resid == 0)
 		return (0);
 
-	if (uio->uio_resid < 0 || uio->uio_resid > TUNMRU) {
+	mru = TUNMRU;
+	if (tp->tun_flags & TUN_IFHEAD)
+		mru += sizeof(family);
+	if (uio->uio_resid < 0 || uio->uio_resid > mru) {
 		TUNDEBUG(ifp, "len=%zd!\n", uio->uio_resid);
 		return (EIO);
 	}


More information about the svn-src-all mailing list