Module Name: src Committed By: maxv Date: Sat Aug 29 07:14:50 UTC 2020
Modified Files: src/sys/net: if_tun.c Log Message: Correct my rev1.159, it was incomplete, the check must be done later because the value can change in the meantime (and get set to zero). To generate a diff of this commit: cvs rdiff -u -r1.159 -r1.160 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_tun.c diff -u src/sys/net/if_tun.c:1.159 src/sys/net/if_tun.c:1.160 --- src/sys/net/if_tun.c:1.159 Tue Jun 23 18:30:17 2020 +++ src/sys/net/if_tun.c Sat Aug 29 07:14:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $ */ +/* $NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $ */ /* * Copyright (c) 1988, Julian Onions <j...@cs.nott.ac.uk> @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -857,9 +857,6 @@ tunwrite(dev_t dev, struct uio *uio, int TUNDEBUG("%s: tunwrite\n", ifp->if_xname); - if (uio->uio_resid == 0) - return 0; - if (tp->tun_flags & TUN_PREPADDR) { if (uio->uio_resid < sizeof(dst)) { error = EIO; @@ -890,7 +887,7 @@ tunwrite(dev_t dev, struct uio *uio, int #endif } - if (uio->uio_resid > TUNMTU) { + if (uio->uio_resid == 0 || uio->uio_resid > TUNMTU) { TUNDEBUG("%s: len=%lu!\n", ifp->if_xname, (unsigned long)uio->uio_resid); error = EIO;