Date: Fri, 23 Jul 1999 17:01:49 -0400 (EDT) From: Alfred Perlstein <bright@rush.net> To: John-Mark Gurney <gurney_j@resnet.uoregon.edu> Cc: Poul-Henning Kamp <phk@critter.freebsd.dk>, freebsd-bugs@FreeBSD.ORG Subject: Re: kern/12780: tun code panics when 0 bytes written (PATCH included) Message-ID: <Pine.BSF.3.96.990723165231.27774Q-100000@cygnus.rush.net> In-Reply-To: <19990723133803.42096@hydrogen.fircrest.net>
index | next in thread | previous in thread | raw e-mail
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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990723165231.27774Q-100000>
