Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Protect interface queue manipulations by splnet(). S...



details:   https://anonhg.NetBSD.org/src/rev/c455d5b8f412
branches:  trunk
changeset: 511353:c455d5b8f412
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jun 18 12:32:47 2001 +0000

description:
Protect interface queue manipulations by splnet(). Splsoftnet() is not
enough.

diffstat:

 sys/net/if_pppoe.c |  26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diffs (47 lines):

diff -r 1c441890c5ce -r c455d5b8f412 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Mon Jun 18 12:07:32 2001 +0000
+++ b/sys/net/if_pppoe.c        Mon Jun 18 12:32:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.2 2001/06/14 05:44:24 itojun Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.3 2001/06/18 12:32:47 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Martin Husemann. All rights reserved.
@@ -294,21 +294,29 @@
 pppoe_input()
 {
        struct mbuf *m;
-       int idle = 0;
+       int s, disc_done, data_done;
 
-       while (!idle) {
-               idle = 1;
-               if (!IF_IS_EMPTY(&ppoediscinq)) {
+       do {
+               disc_done = 0;
+               data_done = 0;
+               for (;;) {
+                       s = splnet();
                        IF_DEQUEUE(&ppoediscinq, m);
-                       idle = 0;
+                       splx(s);
+                       if (m == NULL) break;
+                       disc_done = 1;
                        pppoe_disc_input(m);
                }
-               if (!IF_IS_EMPTY(&ppoeinq)) {
+
+               for (;;) {
+                       s = splnet();
                        IF_DEQUEUE(&ppoeinq, m);
-                       idle = 0;
+                       splx(s);
+                       if (m == NULL) break;
+                       data_done = 1;
                        pppoe_data_input(m);
                }
-       }
+       } while (disc_done || data_done);
 }
 
 /* analyze and handle a single received packet while not in session state */



Home | Main Index | Thread Index | Old Index