Some fixes from Bruce:

- don't access time (a volatile) via struct copy.
  - merge botches
  - note risk of CCOUNT accessing *tp outside spltty().

Submitted by:  bde
This commit is contained in:
Peter Wemm 1997-08-22 11:34:08 +00:00
parent 2722459822
commit 080ea4d851
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28583
2 changed files with 10 additions and 8 deletions

View file

@ -69,7 +69,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: if_ppp.c,v 1.42 1997/08/19 14:10:45 peter Exp $ */
/* $Id: if_ppp.c,v 1.43 1997/08/19 17:05:26 peter 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 */
@ -283,7 +283,7 @@ pppdealloc(sc)
if_down(&sc->sc_if);
sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);
microtime(&sc->sc_if.if_lastchange);
gettime(&sc->sc_if.if_lastchange);
sc->sc_devp = NULL;
sc->sc_xfer = 0;
for (;;) {
@ -854,7 +854,7 @@ pppoutput(ifp, m0, dst, rtp)
IF_ENQUEUE(ifq, m0);
(*sc->sc_start)(sc);
}
ifp->if_lastchange = time;
gettime(&ifp->if_lastchange);
ifp->if_opackets++;
ifp->if_obytes += len;
@ -1530,7 +1530,7 @@ ppp_inproc(sc, m)
splx(s);
ifp->if_ipackets++;
ifp->if_ibytes += ilen;
ifp->if_lastchange = time;
gettime(&ifp->if_lastchange);
if (rv)
(*sc->sc_ctlp)(sc);

View file

@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: ppp_tty.c,v 1.21 1997/06/22 02:19:52 brian Exp $ */
/* $Id: ppp_tty.c,v 1.22 1997/08/19 14:10:47 peter Exp $ */
#include "ppp.h"
#if NPPP > 0
@ -383,7 +383,7 @@ pppread(tp, uio, flag)
splx(s);
return (EWOULDBLOCK);
}
error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH, "ttyin", 0);
error = ttysleep(tp, TSA_HUP_OR_INPUT(tp), TTIPRI | PCATCH, "pppin", 0);
if (error) {
splx(s);
return error;
@ -597,6 +597,7 @@ pppasyncstart(sc)
int s;
idle = 0;
/* XXX assumes atomic access to *tp although we're not at spltty(). */
while (CCOUNT(&tp->t_outq) < PPP_HIWAT) {
/*
* See if we have an existing packet partly sent.
@ -618,6 +619,7 @@ pppasyncstart(sc)
* will flush any accumulated garbage. We do this whenever
* the line may have been idle for some time.
*/
/* XXX as above. */
if (CCOUNT(&tp->t_outq) == 0) {
++sc->sc_stats.ppp_obytes;
(void) putc(PPP_FLAG, &tp->t_outq);
@ -625,7 +627,7 @@ pppasyncstart(sc)
/* Calculate the FCS for the first mbuf's worth. */
sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len);
sc->sc_if.if_lastchange = time;
gettime(&sc->sc_if.if_lastchange);
}
for (;;) {
@ -795,7 +797,7 @@ pppstart(tp)
register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc;
/*
* If there is stuff in the output queue, send it now.
* Call output process whether or not there is any output.
* We are being called in lieu of ttstart and must do what it would.
*/
if (tp->t_oproc != NULL)