summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/bpf/net/bpf_filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libpcap/bpf/net/bpf_filter.c')
-rw-r--r--contrib/libpcap/bpf/net/bpf_filter.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/contrib/libpcap/bpf/net/bpf_filter.c b/contrib/libpcap/bpf/net/bpf_filter.c
index 0c4fb00..ad689e1 100644
--- a/contrib/libpcap/bpf/net/bpf_filter.c
+++ b/contrib/libpcap/bpf/net/bpf_filter.c
@@ -38,11 +38,6 @@
* @(#)bpf.c 7.5 (Berkeley) 7/15/91
*/
-#if !(defined(lint) || defined(KERNEL) || defined(_KERNEL))
-static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf_filter.c,v 1.46 2008-01-02 04:16:46 guy Exp $ (LBL)";
-#endif
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -469,6 +464,12 @@ bpf_filter(pc, p, wirelen, buflen)
A /= X;
continue;
+ case BPF_ALU|BPF_MOD|BPF_X:
+ if (X == 0)
+ return 0;
+ A %= X;
+ continue;
+
case BPF_ALU|BPF_AND|BPF_X:
A &= X;
continue;
@@ -477,6 +478,10 @@ bpf_filter(pc, p, wirelen, buflen)
A |= X;
continue;
+ case BPF_ALU|BPF_XOR|BPF_X:
+ A ^= X;
+ continue;
+
case BPF_ALU|BPF_LSH|BPF_X:
A <<= X;
continue;
@@ -501,6 +506,10 @@ bpf_filter(pc, p, wirelen, buflen)
A /= pc->k;
continue;
+ case BPF_ALU|BPF_MOD|BPF_K:
+ A %= pc->k;
+ continue;
+
case BPF_ALU|BPF_AND|BPF_K:
A &= pc->k;
continue;
@@ -509,6 +518,10 @@ bpf_filter(pc, p, wirelen, buflen)
A |= pc->k;
continue;
+ case BPF_ALU|BPF_XOR|BPF_K:
+ A ^= pc->k;
+ continue;
+
case BPF_ALU|BPF_LSH|BPF_K:
A <<= pc->k;
continue;
@@ -611,13 +624,16 @@ bpf_validate(f, len)
case BPF_MUL:
case BPF_OR:
case BPF_AND:
+ case BPF_XOR:
case BPF_LSH:
case BPF_RSH:
case BPF_NEG:
break;
case BPF_DIV:
+ case BPF_MOD:
/*
- * Check for constant division by 0.
+ * Check for constant division or modulus
+ * by 0.
*/
if (BPF_SRC(p->code) == BPF_K && p->k == 0)
return 0;
OpenPOWER on IntegriCloud