mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Allow interfaces to be attached to bpf at times other than boot.
doing so without this patch leads to an infinite loop in the kernel.
This commit is contained in:
parent
b9b51fb731
commit
ed0af9bc44
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30090
@ -37,7 +37,7 @@
|
||||
*
|
||||
* @(#)bpf.c 8.2 (Berkeley) 3/28/94
|
||||
*
|
||||
* $Id: bpf.c,v 1.33 1997/09/14 03:03:05 peter Exp $
|
||||
* $Id: bpf.c,v 1.34 1997/09/16 11:43:42 bde Exp $
|
||||
*/
|
||||
|
||||
#include "bpfilter.h"
|
||||
@ -119,6 +119,7 @@ SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW,
|
||||
*/
|
||||
static struct bpf_if *bpf_iflist;
|
||||
static struct bpf_d bpf_dtab[NBPFILTER];
|
||||
static int bpf_dtab_init;
|
||||
|
||||
static int bpf_allocbufs __P((struct bpf_d *));
|
||||
static void bpf_attachd __P((struct bpf_d *d, struct bpf_if *bp));
|
||||
@ -1264,9 +1265,11 @@ bpfattach(ifp, dlt, hdrlen)
|
||||
/*
|
||||
* Mark all the descriptors free if this hasn't been done.
|
||||
*/
|
||||
if (!D_ISFREE(&bpf_dtab[0]))
|
||||
if (!bpf_dtab_init) {
|
||||
for (i = 0; i < NBPFILTER; ++i)
|
||||
D_MARKFREE(&bpf_dtab[i]);
|
||||
bpf_dtab_init = 1;
|
||||
}
|
||||
|
||||
if (bootverbose)
|
||||
printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
|
||||
|
Loading…
Reference in New Issue
Block a user