summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2016-05-19 13:52:12 +0000
committertuexen <tuexen@FreeBSD.org>2016-05-19 13:52:12 +0000
commit513d614cdfc5c65b52972952697269935f741934 (patch)
tree8b4073d272a7aee71051afaccf637b4b0118adc1 /sys/net
parent0412106b46a9cffa2790ddc17339d96c0dc607c9 (diff)
downloadFreeBSD-src-513d614cdfc5c65b52972952697269935f741934.zip
FreeBSD-src-513d614cdfc5c65b52972952697269935f741934.tar.gz
Allow writing IP packets of length TUNMRU no matter if TUNSIFHEAD is set
or not.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_tun.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index f5aba00..b924ca8 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -848,7 +848,7 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag)
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 *uio, int flag)
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);
}
OpenPOWER on IntegriCloud