From owner-freebsd-bugs Fri Jul 23 14: 4:25 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id 2D99414E53 for ; Fri, 23 Jul 1999 14:04:20 -0700 (PDT) (envelope-from bright@rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id RAA29714; Fri, 23 Jul 1999 17:01:51 -0400 (EDT) Date: Fri, 23 Jul 1999 17:01:49 -0400 (EDT) From: Alfred Perlstein To: John-Mark Gurney Cc: Poul-Henning Kamp , freebsd-bugs@FreeBSD.ORG Subject: Re: kern/12780: tun code panics when 0 bytes written (PATCH included) In-Reply-To: <19990723133803.42096@hydrogen.fircrest.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Fri, 23 Jul 1999, John-Mark Gurney wrote: > Poul-Henning Kamp scribbled this message on Jul 23: > > Zero length writes to a device are legal, at some point it was the > > way to write end of file and end of tape for magtapes: you would > > do one zero length write after each file and two at the end of the > > tape. > > yes, but this prevents tun from panicing BECAUSE of a zero length > write, this does not effect the device subsystem in any way... read > the code... the only other patch for this bug is to change the: > if (error) { > if (top) { > > to: > if (error || top) { > > and I decided that it was best to check and not try to allocate an mbuf > when we know we are just going to free it in a few lines of code.. > > read the code and the patch... I think what Poul-Henning is saying is theat it may be improper to return EIO in this case, perhaps a successful return is warrented? this would also make ppp not complain about an error that it shouldn't get? (sorry about the older version, i haven't cvsup'd yet) Index: if_tun.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_tun.c,v retrieving revision 1.51 diff -u -r1.51 if_tun.c --- if_tun.c 1999/01/17 20:53:47 1.51 +++ if_tun.c 1999/07/24 00:58:39 @@ -521,6 +521,9 @@ TUNDEBUG("%s%d: tunwrite\n", ifp->if_name, ifp->if_unit); + if (uio->uio_resid == 0) + return 0; + if (uio->uio_resid < 0 || uio->uio_resid > TUNMRU) { TUNDEBUG("%s%d: len=%d!\n", ifp->if_name, ifp->if_unit, uio->uio_resid); Is this what you are looking for? -Alfred Perlstein - [bright@rush.net|bright@wintelcom.net] systems administrator and programmer Win Telecom - http://www.wintelcom.net/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message