From 2480e42d2fb95b4fc6ba433cb0b95f6815b55cd7 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 28 Dec 2006 20:06:12 +0000 Subject: check if ifqueue has anything queued before doing the dance of splnet/IF_DEQUEUE/splx; ok various people --- sys/net/if_bridge.c | 4 ++-- sys/net/if_gif.c | 7 ++++--- sys/net/if_ppp.c | 4 ++-- sys/net/if_pppoe.c | 6 +++--- sys/netinet/ip_input.c | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'sys') diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 3fc842b8c5e..349c51c20d2 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.155 2006/12/11 22:11:48 reyk Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.156 2006/12/28 20:06:11 deraadt Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1168,7 +1168,7 @@ bridgeintr(void) int s; LIST_FOREACH(sc, &bridge_list, sc_list) { - for (;;) { + while (sc->sc_if.if_snd.ifq_head) { s = splnet(); IF_DEQUEUE(&sc->sc_if.if_snd, m); splx(s); diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 46ab0812087..fbca691a453 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.37 2006/11/16 07:58:43 itojun Exp $ */ +/* $OpenBSD: if_gif.c,v 1.38 2006/12/28 20:06:11 deraadt Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -165,12 +165,13 @@ gif_start(ifp) dst.sa_family = AF_LINK; #endif /* NBRIDGE */ - for (;;) { + while (ifp->if_snd.ifq_head) { s = splnet(); IF_DEQUEUE(&ifp->if_snd, m); splx(s); - if (m == NULL) return; + if (m == NULL) + return; #if NBRIDGE > 0 /* Sanity check -- interface should be member of a bridge */ diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 87c873148a2..f1ca74c7309 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.46 2006/03/25 22:41:47 djm Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.47 2006/12/28 20:06:11 deraadt Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -1127,7 +1127,7 @@ pppintr() splx(s2); (*sc->sc_start)(sc); } - for (;;) { + while (sc->sc_rawq.ifq_head) { s2 = splnet(); IF_DEQUEUE(&sc->sc_rawq, m); splx(s2); diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 3ca551acc30..062a71dcb9b 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.9 2006/07/11 21:21:59 canacar Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.10 2006/12/28 20:06:11 deraadt Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -370,13 +370,13 @@ pppoeintr(void) splassert(IPL_SOFTNET); LIST_FOREACH(sc, &pppoe_softc_list, sc_list) { - for (;;) { + while (ppoediscinq.ifq_head) { MBUFLOCK(IF_DEQUEUE(&ppoediscinq, m);); if (m == NULL) break; pppoe_disc_input(m); } - for (;;) { + while (ppoeinq.ifq_head) { MBUFLOCK(IF_DEQUEUE(&ppoeinq, m);); if (m == NULL) break; pppoe_data_input(m); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index d49d43e8687..deca652ad8a 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.145 2006/11/27 12:27:45 henning Exp $ */ +/* $OpenBSD: ip_input.c,v 1.146 2006/12/28 20:06:10 deraadt Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -247,7 +247,7 @@ ipintr() struct mbuf *m; int s; - while (1) { + while (ipintrq.ifq_head) { /* * Get next datagram off input queue and get IP header * in first mbuf. -- cgit v1.2.3