DragonFly BSD
DragonFly bugs List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ppp problems


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Oct 2004 21:01:35 -0700 (PDT)

    I believe I have fixed the pppd infinite loop problem.

    It turns out that some of the network protocol stack work we did caused
    a tty placeholder token function to be called incorrectly, resulting in
    the tty code believing that there was data pending (hence pppd's select()
    would return instantly) even though there was in fact no data pending
    in the ppp line discipline's packet queue.

    I have committed the patch and slipped the DragonFly_Stable tag.  The
    patch is included below.

						-Matt

Index: if_ppp.c
===================================================================
RCS file: /cvs/src/sys/net/ppp/if_ppp.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- if_ppp.c	16 Sep 2004 04:39:30 -0000	1.20
+++ if_ppp.c	16 Oct 2004 03:58:52 -0000	1.21
@@ -70,7 +70,7 @@
  */
 
 /* $FreeBSD: src/sys/net/if_ppp.c,v 1.67.2.4 2002/04/14 21:41:48 luigi Exp $ */
-/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.20 2004/09/16 04:39:30 dillon Exp $ */
+/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.21 2004/10/16 03:58:52 dillon Exp $ */
 /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
@@ -1503,10 +1503,18 @@
 	break;
     }
 
-    if (isr == -1)
+    /*
+     * If we found a netproto just pass it to the proto.  Otherwise queue
+     * the packet to the tty (e.g. pppd).  Note that sc_ctlp() must be
+     * called EXACTLY once per packet queued.
+     */
+    if (isr == -1) {
 	rv = IF_HANDOFF(&sc->sc_inq, m, NULL);
-    else
+	if (rv)
+	    (*sc->sc_ctlp)(sc);
+    } else {
 	rv = (netisr_queue(isr, m) == 0);
+    }
     if (!rv) {
 	if (sc->sc_flags & SC_DEBUG)
 	    printf("%s: input queue full\n", ifp->if_xname);
@@ -1518,9 +1526,6 @@
     ifp->if_ibytes += ilen;
     getmicrotime(&ifp->if_lastchange);
 
-    if (rv)
-	(*sc->sc_ctlp)(sc);
-
     return;
 
  bad:



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