From: deraadt Date: Fri, 15 Dec 1995 01:40:58 +0000 (+0000) Subject: use m_pkthdr.len for FIONREAD, correctly indicates how much data is available X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c9011b5a343b804a2c17e7568f76d835a0562746;p=openbsd use m_pkthdr.len for FIONREAD, correctly indicates how much data is available --- diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index dcd59335bcc..0e096f1bf20 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.18 1995/06/13 05:59:37 mycroft Exp $ */ +/* $NetBSD: if_tun.c,v 1.19 1995/12/13 23:47:40 pk Exp $ */ /* * Copyright (c) 1988, Julian Onions @@ -360,7 +360,7 @@ tuncioctl(dev, cmd, data, flag, p) case FIONREAD: s = splimp(); if (tp->tun_if.if_snd.ifq_head) - *(int *)data = tp->tun_if.if_snd.ifq_head->m_len; + *(int *)data = tp->tun_if.if_snd.ifq_head->m_pkthdr.len; else *(int *)data = 0; splx(s); @@ -428,6 +428,8 @@ tunread(dev, uio) TUNDEBUG("Dropping mbuf\n"); m_freem(m0); } + if (error) + ifp->if_ierrors++; return error; } @@ -478,6 +480,7 @@ tunwrite(dev, uio) if (error) { if (top) m_freem (top); + ifp->if_ierrors++; return error; }