|
diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4
|
|
index 69ed51c455..de93de41a9 100644
|
|
--- a/share/man/man4/bpf.4
|
|
+++ b/share/man/man4/bpf.4
|
|
@@ -591,10 +591,14 @@ A <- A - k
|
|
A <- A * k
|
|
.It Li BPF_ALU+BPF_DIV+BPF_K
|
|
A <- A / k
|
|
+.It Li BPF_ALU+BPF_MOD+BPF_K
|
|
+A <- A % k
|
|
.It Li BPF_ALU+BPF_AND+BPF_K
|
|
A <- A & k
|
|
.It Li BPF_ALU+BPF_OR+BPF_K
|
|
A <- A | k
|
|
+.It Li BPF_ALU+BPF_XOR+BPF_K
|
|
+A <- A ^ k
|
|
.It Li BPF_ALU+BPF_LSH+BPF_K
|
|
A <- A << k
|
|
.It Li BPF_ALU+BPF_RSH+BPF_K
|
|
@@ -607,10 +611,14 @@ A <- A - X
|
|
A <- A * X
|
|
.It Li BPF_ALU+BPF_DIV+BPF_X
|
|
A <- A / X
|
|
+.It Li BPF_ALU+BPF_OD+BPF_X
|
|
+A <- A % X
|
|
.It Li BPF_ALU+BPF_AND+BPF_X
|
|
A <- A & X
|
|
.It Li BPF_ALU+BPF_OR+BPF_X
|
|
A <- A | X
|
|
+.It Li BPF_ALU+BPF_XOR+BPF_X
|
|
+A <- A ^ X
|
|
.It Li BPF_ALU+BPF_LSH+BPF_X
|
|
A <- A << X
|
|
.It Li BPF_ALU+BPF_RSH+BPF_X
|
|
diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c
|
|
index c059535fb3..c4b5aee97f 100644
|
|
--- a/sys/net/bpf_filter.c
|
|
+++ b/sys/net/bpf_filter.c
|
|
@@ -432,6 +432,12 @@ bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int 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;
|
|
@@ -440,6 +446,10 @@ bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen)
|
|
A |= X;
|
|
continue;
|
|
|
|
+ case BPF_ALU|BPF_XOR|BPF_X:
|
|
+ A ^= X;
|
|
+ continue;
|
|
+
|
|
case BPF_ALU|BPF_LSH|BPF_X:
|
|
A <<= X;
|
|
continue;
|
|
@@ -464,6 +474,10 @@ bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int 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;
|
|
@@ -472,6 +486,10 @@ bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int 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;
|
|
@@ -564,6 +582,7 @@ bpf_validate(const struct bpf_insn *f, int len)
|
|
case BPF_NEG:
|
|
break;
|
|
case BPF_DIV:
|
|
+ case BPF_MOD:
|
|
/*
|
|
* Check for constant division by 0.
|
|
*/
|