Accept ARP requests with an ethernet trailer, but trim it
authorMartin Willi <martin@revosec.ch>
Wed, 2 Jun 2010 08:05:43 +0000 (10:05 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 3 Jun 2010 06:39:33 +0000 (08:39 +0200)
src/libcharon/plugins/farp/farp_spoofer.c

index 29e64e3..20bb44f 100644 (file)
@@ -156,8 +156,8 @@ farp_spoofer_t *farp_spoofer_create(farp_listener_t *listener)
                BPF_STMT(BPF_LD+BPF_H+BPF_ABS, offsetof(arp_t, opcode)),
                BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ARPOP_REQUEST, 0, 3),
                BPF_STMT(BPF_LD+BPF_W+BPF_LEN, 0),
-               BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 28, 0, 1),
-               BPF_STMT(BPF_RET+BPF_A, 0),
+               BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, sizeof(arp_t), 0, 1),
+               BPF_STMT(BPF_RET+BPF_K, sizeof(arp_t)),
                BPF_STMT(BPF_RET+BPF_K, 0),
        };
        struct sock_fprog arp_request_filter = {