summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-06-12 10:49:18 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-06-12 10:49:18 +0000
commit8e13401b1fb39b925a5bd7c4940b9d1897c1274e (patch)
tree8739232aba1eb807c8c3568732ef72d15d350ab8 /sys
parent7938e999189db6db17ccc33b881d8457cf124da9 (diff)
in FIONREAD and FREAD, use IFQ_POLL instead of looking at if_snd.ifq_len /
ifq_head, to make altq work. prevents programs from spinning in non-blocking select()/read() loops in case of queues hitting their limits. This makes queueing on tun interfaces work. while it is still advised to assign packets to queues on tunX and queue on the physical interface in generic, this doesn't work in the PPPoE case with the userland pppoe process, there the mbuf tags with the queue IDs don't survive obviously. based on diff from Trevor Talbot, tested successfully by a lot of people on the pf@benzedrine.cx list. ok pb@ kjc@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_tun.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index a0cfcc85016..bc79e9037c5 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.47 2003/05/03 21:15:11 deraadt Exp $ */
+/* $OpenBSD: if_tun.c,v 1.48 2003/06/12 10:49:17 henning Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -450,6 +450,7 @@ tunioctl(dev, cmd, data, flag, p)
int unit, s;
struct tun_softc *tp;
struct tuninfo *tunp;
+ struct mbuf *m;
if ((unit = minor(dev)) >= ntun)
return (ENXIO);
@@ -511,8 +512,9 @@ tunioctl(dev, cmd, data, flag, p)
tp->tun_flags &= ~TUN_ASYNC;
break;
case FIONREAD:
- if (tp->tun_if.if_snd.ifq_head)
- *(int *)data = tp->tun_if.if_snd.ifq_head->m_pkthdr.len;
+ IFQ_POLL(&tp->tun_if.if_snd, m);
+ if (m != NULL)
+ *(int *)data = m->m_pkthdr.len;
else
*(int *)data = 0;
break;
@@ -748,6 +750,7 @@ tunselect(dev, rw, p)
int unit, s;
struct tun_softc *tp;
struct ifnet *ifp;
+ struct mbuf *m;
if ((unit = minor(dev)) >= ntun)
return (ENXIO);
@@ -759,7 +762,8 @@ tunselect(dev, rw, p)
switch (rw) {
case FREAD:
- if (ifp->if_snd.ifq_len > 0) {
+ IFQ_POLL(&ifp->if_snd, m);
+ if (m != NULL) {
splx(s);
TUNDEBUG(("%s: tunselect q=%d\n", ifp->if_xname,
ifp->if_snd.ifq_len));