summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMantas Mikulnas <grawity@gmail.com>2017-03-24 12:23:39 +0000
committerRoy Marples <roy@marples.name>2017-03-24 12:26:59 +0000
commit8f2d1fafd1a28025b2558fc42ad03768b489facd (patch)
tree881a78aae6c2183a9124b0b0ab9eca49cb966b3e
parentb76edfe80bc2435fbe3ff973f3b28d77b83eb114 (diff)
downloadparpd-8f2d1fafd1a28025b2558fc42ad03768b489facd.tar.xz
Fix inverted check for ARP packet type
Summary: Currently the BPF filter accepts all ARP packets that _aren't_ requests. Fixes T110. Reviewers: roy Reviewed By: roy Tags: #parpd Maniphest Tasks: T110 Differential Revision: https://dev.marples.name/D102
-rw-r--r--bpf-filter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/bpf-filter.h b/bpf-filter.h
index 1d28dbe..9be7a3c 100644
--- a/bpf-filter.h
+++ b/bpf-filter.h
@@ -62,7 +62,8 @@ static const struct bpf_insn bpf_arp_filter [] = {
/* Make sure this is an ARP REQUEST. */
BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct arphdr, ar_op)),
- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REQUEST, 2, 0),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REQUEST, 1, 0),
+ BPF_STMT(BPF_RET + BPF_K, 0),
/* Make sure the protocol length matches. */
BPF_STMT(BPF_LD + BPF_B + BPF_IND, offsetof(struct arphdr, ar_pln)),