From 1911977e6102bc53bcd750b4bebcf55b4964c16c Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 16 Oct 2004 03:58:52 +0000 Subject: [PATCH] Fix a bug where sc_ctlp() is improperly called when the packet is passed up the protocol stack. sc_ctlp() must be called exactly once for each packet queued to the tty and ONLY when the packet is queued to the tty. Otherwise the tty's t_canq will start to fill up and the tty code will incorrectly believe that there are packets pending when there might not be. The characteristic of this bug was that pppd would stay in a 'R'un state polling the tty for non-existant packets. Reported-by: =?ISO-8859-1?Q?Cristi=E1n_H=2E_Garc=EDa_Whiting?= , Sarunas Vancevicius --- sys/net/ppp/if_ppp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/net/ppp/if_ppp.c b/sys/net/ppp/if_ppp.c index 2d60be1ce2..fd7c88ec74 100644 --- a/sys/net/ppp/if_ppp.c +++ b/sys/net/ppp/if_ppp.c @@ -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 @@ ppp_inproc(sc, m) 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 @@ ppp_inproc(sc, m) ifp->if_ibytes += ilen; getmicrotime(&ifp->if_lastchange); - if (rv) - (*sc->sc_ctlp)(sc); - return; bad: -- 2.41.0