Protect the use of bpf_mtap so bpf isn't needed.

aue: Limit the number of error messages at disconnect by using ratecheck().
This commit is contained in:
augustss 2000-03-01 19:00:51 +00:00
parent 7d57276982
commit 3218dd992d
4 changed files with 27 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_aue.c,v 1.24 2000/02/17 18:42:21 augustss Exp $ */
/* $NetBSD: if_aue.c,v 1.25 2000/03/01 19:00:51 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@ -174,6 +174,8 @@ static struct aue_type aue_devs[] = {
{ 0, 0 }
};
static struct timeval aue_errinterval = { 0, 2500000 }; /* 0.25 s*/
USB_DECLARE_DRIVER(aue);
static int aue_tx_list_init __P((struct aue_softc *));
@ -1164,8 +1166,13 @@ aue_rxeof(xfer, priv, status)
if (status != USBD_NORMAL_COMPLETION) {
if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
return;
printf("%s: usb error on rx: %s\n", USBDEVNAME(sc->aue_dev),
usbd_errstr(status));
sc->aue_rx_errs++;
if (ratecheck(&sc->aue_rx_notice, &aue_errinterval)) {
printf("%s: %u usb errors on rx: %s\n",
USBDEVNAME(sc->aue_dev), sc->aue_rx_errs,
usbd_errstr(status));
sc->aue_rx_errs = 0;
}
if (status == USBD_STALLED)
usbd_clear_endpoint_stall(sc->aue_ep[AUE_ENDPT_RX]);
goto done;
@ -1213,6 +1220,7 @@ aue_rxeof(xfer, priv, status)
goto done1;
}
#if NBPFILTER > 0
/*
* Handle BPF listeners. Let the BPF user see the packet, but
* don't pass it up to the ether_input() layer unless it's
@ -1230,6 +1238,7 @@ aue_rxeof(xfer, priv, status)
goto done1;
}
}
#endif
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->aue_dev),
__FUNCTION__, m->m_len));
@ -1429,12 +1438,14 @@ aue_start(ifp)
return;
}
#if NBPFILTER > 0
/*
* If there's a BPF listener, bounce a copy of this frame
* to him.
*/
if (ifp->if_bpf)
BPF_MTAP(ifp, m_head);
#endif
ifp->if_flags |= IFF_OACTIVE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_auereg.h,v 1.5 2000/02/17 18:42:21 augustss Exp $ */
/* $NetBSD: if_auereg.h,v 1.6 2000/03/01 19:00:51 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@ -258,6 +258,8 @@ struct aue_softc {
char aue_dying;
char aue_attached;
u_int aue_rx_errs;
struct timeval aue_rx_notice;
};
#define AUE_TIMEOUT 1000

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cue.c,v 1.8 2000/02/27 22:15:24 augustss Exp $ */
/* $NetBSD: if_cue.c,v 1.9 2000/03/01 19:00:51 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@ -929,6 +929,7 @@ cue_rxeof(xfer, priv, status)
goto done1;
}
#if NBPFILTER > 0
/*
* Handle BPF listeners. Let the BPF user see the packet, but
* don't pass it up to the ether_input() layer unless it's
@ -946,6 +947,7 @@ cue_rxeof(xfer, priv, status)
goto done1;
}
}
#endif
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->cue_dev),
__FUNCTION__, m->m_len));
@ -1118,12 +1120,14 @@ cue_start(ifp)
return;
}
#if NBPFILTER > 0
/*
* If there's a BPF listener, bounce a copy of this frame
* to him.
*/
if (ifp->if_bpf)
BPF_MTAP(ifp, m_head);
#endif
ifp->if_flags |= IFF_OACTIVE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_kue.c,v 1.9 2000/02/29 19:08:09 hubertf Exp $ */
/* $NetBSD: if_kue.c,v 1.10 2000/03/01 19:00:51 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@ -991,6 +991,7 @@ kue_rxeof(xfer, priv, status)
goto done1;
}
#if NBPFILTER > 0
/*
* Handle BPF listeners. Let the BPF user see the packet, but
* don't pass it up to the ether_input() layer unless it's
@ -1008,6 +1009,7 @@ kue_rxeof(xfer, priv, status)
goto done1;
}
}
#endif
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->kue_dev),
__FUNCTION__, m->m_len));
@ -1156,12 +1158,14 @@ kue_start(ifp)
return;
}
#if NBPFILTER > 0
/*
* If there's a BPF listener, bounce a copy of this frame
* to him.
*/
if (ifp->if_bpf)
BPF_MTAP(ifp, m_head);
#endif
ifp->if_flags |= IFF_OACTIVE;