From owner-freebsd-bugs Fri Jul 23 20:59:35 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from awfulhak.org (dynamic-88.max1-du-ws.dialnetwork.pavilion.co.uk [212.74.8.88]) by hub.freebsd.org (Postfix) with ESMTP id 6C8251570B for ; Fri, 23 Jul 1999 20:59:27 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from keep.lan.Awfulhak.org (root@keep.lan.Awfulhak.org [172.16.0.8]) by awfulhak.org (8.9.3/8.9.3) with ESMTP id EAA08355; Sat, 24 Jul 1999 04:40:13 +0100 (BST) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by keep.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id EAA05607; Sat, 24 Jul 1999 04:40:30 +0100 (BST) (envelope-from brian@keep.lan.Awfulhak.org) Message-Id: <199907240340.EAA05607@keep.lan.Awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: Alfred Perlstein Cc: John-Mark Gurney , Poul-Henning Kamp , freebsd-bugs@FreeBSD.ORG Subject: Re: kern/12780: tun code panics when 0 bytes written (PATCH included) In-reply-to: Your message of "Fri, 23 Jul 1999 17:01:49 EDT." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 24 Jul 1999 04:40:29 +0100 From: Brian Somers 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? [.....] I think the return should be either EINVAL or EMSGSIZE - EMSGSIZE is now returned in OpenBSD (it's also returned for > MAX_MRU there). IMHO it's invalid to write 0 bytes to this sort of device - it's expecting a whole packet. Also, ppp *should* complain. It didn't mean to write zero bytes - it's a bug I introduced recently with my device layering changes where IP fragments are mis-handled as zero length mbufs. It's now fixed. -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message