summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2008-04-24 11:36:38 +0000
committerdlg <dlg@openbsd.org>2008-04-24 11:36:38 +0000
commitc8af8aa8c6aa2959c8b13a74959a094f9ca50a5a (patch)
tree43db592e57a2f9f9b8ee4ed0485d905daa351532
parentsome ciss(4) firmwares use different physical drive addressing, resulting (diff)
downloadwireguard-openbsd-c8af8aa8c6aa2959c8b13a74959a094f9ca50a5a.tar.xz
wireguard-openbsd-c8af8aa8c6aa2959c8b13a74959a094f9ca50a5a.zip
the softnet intr handlers check if the input queue has packets on
it by reading the queues head pointer. if that pointer is not null then it takes splnet and dequeues a packet for handling. this is bad because the ifqueue head is modified at splnet and the sofnet handlers read it without holding splnet. this removes that check of the head pointer and simply checks if the dequeue gave us a packet or not before proceeding. found while reading mpls code. discussed with norby@ and henning@ ok mcbride@ henning@
-rw-r--r--sys/net/if_bridge.c4
-rw-r--r--sys/net/if_pppoe.c6
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--sys/netinet/ip_input.c6
-rw-r--r--sys/netinet6/ip6_input.c6
-rw-r--r--sys/netmpls/mpls_input.c4
6 files changed, 15 insertions, 15 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 913965ea0c9..1ab9e440f26 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.166 2007/12/20 02:53:02 brad Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.167 2008/04/24 11:36:38 dlg Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -1170,7 +1170,7 @@ bridgeintr(void)
int s;
LIST_FOREACH(sc, &bridge_list, sc_list) {
- while (sc->sc_if.if_snd.ifq_head) {
+ for (;;) {
s = splnet();
IF_DEQUEUE(&sc->sc_if.if_snd, m);
splx(s);
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 5190d502f93..b1d5c18a8e4 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.19 2008/03/20 16:46:34 brad Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.20 2008/04/24 11:36:38 dlg Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -376,7 +376,7 @@ pppoeintr(void)
splassert(IPL_SOFTNET);
- while (ppoediscinq.ifq_head) {
+ for (;;) {
s = splnet();
IF_DEQUEUE(&ppoediscinq, m);
splx(s);
@@ -385,7 +385,7 @@ pppoeintr(void)
pppoe_disc_input(m);
}
- while (ppoeinq.ifq_head) {
+ for (;;) {
s = splnet();
IF_DEQUEUE(&ppoeinq, m);
splx(s);
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 4704fed67cc..d9220a22e16 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.70 2008/02/05 22:57:30 mpf Exp $ */
+/* $OpenBSD: if_ether.c,v 1.71 2008/04/24 11:36:38 dlg Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -469,7 +469,7 @@ arpintr()
struct arphdr *ar;
int s, len;
- while (arpintrq.ifq_head) {
+ for (;;) {
s = splnet();
IF_DEQUEUE(&arpintrq, m);
splx(s);
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 2b691ffa1ec..05b65ae94ef 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.157 2008/02/05 22:57:31 mpf Exp $ */
+/* $OpenBSD: ip_input.c,v 1.158 2008/04/24 11:36:38 dlg Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -226,7 +226,7 @@ ipintr()
struct mbuf *m;
int s;
- while (ipintrq.ifq_head) {
+ for (;;) {
/*
* Get next datagram off input queue and get IP header
* in first mbuf.
@@ -234,7 +234,7 @@ ipintr()
s = splnet();
IF_DEQUEUE(&ipintrq, m);
splx(s);
- if (m == 0)
+ if (m == NULL)
return;
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 15eeaddb644..1f51ce38a21 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.82 2008/02/24 23:31:30 mcbride Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.83 2008/04/24 11:36:39 dlg Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -185,11 +185,11 @@ ip6intr()
int s;
struct mbuf *m;
- while (ip6intrq.ifq_head) {
+ for (;;) {
s = splnet();
IF_DEQUEUE(&ip6intrq, m);
splx(s);
- if (m == 0)
+ if (m == NULL)
return;
ip6_input(m);
}
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index dd4b6f08c99..9d6c7f71909 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.3 2008/04/23 12:59:35 dlg Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.4 2008/04/24 11:36:39 dlg Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -49,7 +49,7 @@ mplsintr(void)
struct mbuf *m;
int s;
- while (mplsintrq.ifq_head) {
+ for (;;) {
/* Get next datagram of input queue */
s = splnet();
IF_DEQUEUE(&mplsintrq, m);