summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-05-04 03:09:28 +0000
committercsjp <csjp@FreeBSD.org>2005-05-04 03:09:28 +0000
commitfaca84b3b15259d7140a300593dc371e3f124f64 (patch)
tree3dae817e64ba369f2050ddb0ab5c7ead273fed93 /sys
parenta3f4657e28ff218b48cd1de18a60e4e5b21e8bcf (diff)
downloadFreeBSD-src-faca84b3b15259d7140a300593dc371e3f124f64.zip
FreeBSD-src-faca84b3b15259d7140a300593dc371e3f124f64.tar.gz
-introduce net.bpf sysctl instead of the less intuitive debug.*
debug.bpf_bufsize is now net.bpf.bufsize debug.bpf_maxbufsize is now net.bpf.maxbufsize -move function prototypes for bpf_drvinit and bpf_clone up to the top of the file with the others -assert bpfd lock in catchpacket() and bpf_wakeup() MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bpf.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 3cce6e8..31a5b11 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -81,12 +81,13 @@ static MALLOC_DEFINE(M_BPF, "BPF", "BPF data");
/*
* The default read buffer size is patchable.
*/
+SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG_RW, 0, "bpf sysctl");
static int bpf_bufsize = 4096;
-SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW,
- &bpf_bufsize, 0, "");
+SYSCTL_INT(_net_bpf, OID_AUTO, bufsize, CTLFLAG_RW,
+ &bpf_bufsize, 0, "");
static int bpf_maxbufsize = BPF_MAXBUFSIZE;
-SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW,
- &bpf_maxbufsize, 0, "");
+SYSCTL_INT(_net_bpf, OID_AUTO, maxbufsize, CTLFLAG_RW,
+ &bpf_maxbufsize, 0, "");
/*
* bpf_iflist is a list of BPF interface structures, each corresponding to a
@@ -116,6 +117,8 @@ static int bpf_getdltlist(struct bpf_d *, struct bpf_dltlist *);
static int bpf_setdlt(struct bpf_d *, u_int);
static void filt_bpfdetach(struct knote *);
static int filt_bpfread(struct knote *, long);
+static void bpf_drvinit(void *);
+static void bpf_clone(void *, char *, int, struct cdev **);
static d_open_t bpfopen;
static d_close_t bpfclose;
@@ -523,6 +526,8 @@ static __inline void
bpf_wakeup(d)
struct bpf_d *d;
{
+
+ BPFD_LOCK_ASSERT(d);
if (d->bd_state == BPF_WAITING) {
callout_stop(&d->bd_callout);
d->bd_state = BPF_IDLE;
@@ -1313,6 +1318,7 @@ catchpacket(d, pkt, pktlen, snaplen, cpfn)
int hdrlen = d->bd_bif->bif_hdrlen;
int do_wakeup = 0;
+ BPFD_LOCK_ASSERT(d);
/*
* Figure out how many bytes to move. If the packet is
* greater or equal to the snapshot length, transfer that
@@ -1586,10 +1592,6 @@ bpf_setdlt(d, dlt)
return (bp == NULL ? EINVAL : 0);
}
-static void bpf_drvinit(void *unused);
-
-static void bpf_clone(void *arg, char *name, int namelen, struct cdev **dev);
-
static void
bpf_clone(arg, name, namelen, dev)
void *arg;
OpenPOWER on IntegriCloud