summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-12 03:35:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-12 03:35:12 +0000
commite188fd595afdc378adf11d7939307d5b04bc82df (patch)
tree5d99a47edc41a1a77ee97d28ea9274c3c6c3d829 /sys/net
parent2553ce04767666557e49a10098dade45ad5305db (diff)
mark descriptors free in bpfilterattach() instead of bpfattach(); clearly
must not re-marking them when new interfaces are added while one or more bpf channels are in use; my fix to netbsd pr#3189, Jean-Luc.Richier@imag.fr
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 083f20bf10c..0b2183f51b1 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.7 1997/01/27 23:21:18 deraadt Exp $ */
+/* $OpenBSD: bpf.c,v 1.8 1997/02/12 03:35:11 deraadt Exp $ */
/* $NetBSD: bpf.c,v 1.27 1996/05/07 05:26:02 thorpej Exp $ */
/*
@@ -103,19 +103,6 @@ int bpf_bufsize = BPF_BUFSIZE;
struct bpf_if *bpf_iflist;
struct bpf_d bpf_dtab[NBPFILTER];
-#if BSD >= 199207 || NetBSD0_9 >= 2
-/*
- * bpfilterattach() is called at boot time in new systems. We do
- * nothing here since old systems will not call this.
- */
-/* ARGSUSED */
-void
-bpfilterattach(n)
- int n;
-{
-}
-#endif
-
static int bpf_allocbufs __P((struct bpf_d *));
static int bpf_allocbufs __P((struct bpf_d *));
static void bpf_freed __P((struct bpf_d *));
@@ -318,6 +305,27 @@ bpf_detachd(d)
#define D_MARKFREE(d) ((d)->bd_next = (d))
#define D_MARKUSED(d) ((d)->bd_next = 0)
+#if BSD >= 199207 || NetBSD0_9 >= 2
+/*
+ * bpfilterattach() is called at boot time in new systems. We do
+ * nothing here since old systems will not call this.
+ */
+/* ARGSUSED */
+void
+bpfilterattach(n)
+ int n;
+{
+ int i;
+
+ /*
+ * Mark all the descriptors free if this hasn't been done.
+ */
+ if (!D_ISFREE(&bpf_dtab[0]))
+ for (i = 0; i < NBPFILTER; ++i)
+ D_MARKFREE(&bpf_dtab[i]);
+}
+#endif
+
/*
* Open ethernet device. Returns ENXIO for illegal minor device number,
* EBUSY if file is open by another process.
@@ -1264,7 +1272,6 @@ bpfattach(driverp, ifp, dlt, hdrlen)
u_int dlt, hdrlen;
{
struct bpf_if *bp;
- int i;
#if BSD < 199103
static struct bpf_if bpf_ifs[NBPFILTER];
static int bpfifno;
@@ -1294,13 +1301,6 @@ bpfattach(driverp, ifp, dlt, hdrlen)
*/
bp->bif_hdrlen = BPF_WORDALIGN(hdrlen + SIZEOF_BPF_HDR) - hdrlen;
- /*
- * Mark all the descriptors free if this hasn't been done.
- */
- if (!D_ISFREE(&bpf_dtab[0]))
- for (i = 0; i < NBPFILTER; ++i)
- D_MARKFREE(&bpf_dtab[i]);
-
#if 0
printf("bpf: %s attached\n", ifp->if_xname);
#endif