Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jul 1999 04:40:29 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        Alfred Perlstein <bright@rush.net>
Cc:        John-Mark Gurney <gurney_j@resnet.uoregon.edu>, 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:  <199907240340.EAA05607@keep.lan.Awfulhak.org>
In-Reply-To: Your message of "Fri, 23 Jul 1999 17:01:49 EDT." <Pine.BSF.3.96.990723165231.27774Q-100000@cygnus.rush.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <brian@Awfulhak.org>                        <brian@FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@OpenBSD.org>
Don't _EVER_ lose your sense of humour !          <brian@FreeBSD.org.uk>




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907240340.EAA05607>