summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/bpf.c12
-rw-r--r--sys/net/bpf.h4
-rw-r--r--sys/net/bpfdesc.h3
3 files changed, 16 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 73648a532bd..a9d1821a46f 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.116 2015/01/29 19:44:32 tedu Exp $ */
+/* $OpenBSD: bpf.c,v 1.117 2015/02/10 00:53:55 pelikan Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -840,6 +840,14 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
(BPF_DIRECTION_IN|BPF_DIRECTION_OUT);
break;
+ case BIOCGQUEUE: /* get queue */
+ *(u_int *)addr = d->bd_queue;
+ break;
+
+ case BIOCSQUEUE: /* set queue */
+ d->bd_queue = *(u_int *)addr;
+ break;
+
case FIONBIO: /* Non-blocking I/O */
if (*(int *)addr)
d->bd_rtout = -1;
@@ -1187,6 +1195,8 @@ _bpf_mtap(caddr_t arg, struct mbuf *m, u_int direction,
++d->bd_rcount;
if ((direction & d->bd_dirfilt) != 0)
slen = 0;
+ else if (d->bd_queue && m->m_pkthdr.pf.qid != d->bd_queue)
+ slen = 0;
else
slen = bpf_filter(d->bd_rfilter, (u_char *)m,
pktlen, 0);
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index f733ef7de4c..188bb79e4e1 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.h,v 1.47 2014/10/07 11:16:23 dlg Exp $ */
+/* $OpenBSD: bpf.h,v 1.48 2015/02/10 00:53:55 pelikan Exp $ */
/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */
/*
@@ -119,6 +119,8 @@ struct bpf_version {
#define BIOCGDLTLIST _IOWR('B',123, struct bpf_dltlist)
#define BIOCGDIRFILT _IOR('B',124, u_int)
#define BIOCSDIRFILT _IOW('B',125, u_int)
+#define BIOCGQUEUE _IOR('B',126, u_int)
+#define BIOCSQUEUE _IOW('B',127, u_int)
/*
* Direction filters for BIOCSDIRFILT/BIOCGDIRFILT
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 256d2518d93..40d35479696 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpfdesc.h,v 1.23 2014/10/05 18:43:56 lteo Exp $ */
+/* $OpenBSD: bpfdesc.h,v 1.24 2015/02/10 00:53:55 pelikan Exp $ */
/* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */
/*
@@ -80,6 +80,7 @@ struct bpf_d {
u_char bd_locked; /* true if descriptor is locked */
u_char bd_fildrop; /* true if filtered packets will be dropped */
u_char bd_dirfilt; /* direction filter */
+ u_int bd_queue; /* the queue the user wants to watch (0 == all) */
int bd_hdrcmplt; /* false to fill in src lladdr automatically */
int bd_async; /* non-zero if packet reception should generate signal */
int bd_sig; /* signal to send upon packet reception */