summaryrefslogtreecommitdiff
path: root/eth-multiplexer/ethernet.c
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2010-08-02 03:57:50 +0200
committerZheng Da <zhengda1936@gmail.com>2010-08-02 03:57:50 +0200
commitcea8889d0470c0c1484cbb1246924dda139f63fc (patch)
treeceae893d55d24ca905d78a8866cf7b27054e993d /eth-multiplexer/ethernet.c
parent08e7e43c2b332098920bd13b6dd25607b71c15a6 (diff)
Use BPF filter in eth-multiplexer.
Diffstat (limited to 'eth-multiplexer/ethernet.c')
-rw-r--r--eth-multiplexer/ethernet.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/eth-multiplexer/ethernet.c b/eth-multiplexer/ethernet.c
index 5d4e9239..32c5589f 100644
--- a/eth-multiplexer/ethernet.c
+++ b/eth-multiplexer/ethernet.c
@@ -45,16 +45,15 @@ mach_port_t ether_port;
/* Port for receiving messages from the interface. */
static mach_port_t readptname;
-/* Accept ARP and IP packets. */
-static short ether_filter[] =
+/* The BPF instruction allows IP and ARP packets */
+static struct bpf_insn ether_filter[] =
{
-#ifdef NETF_IN
- /* We have to tell the packet filtering code that we're interested in
- incoming packets. */
- NETF_IN, /* Header. */
-#endif
- NETF_PUSHLIT | NETF_NOP,
- 1
+ {NETF_IN|NETF_BPF, /* Header. */ 0, 0, 0},
+ {40, 0, 0, 12},
+ {21, 1, 0, 2054},
+ {21, 0, 1, 2048},
+ {6, 0, 0, 1500},
+ {6, 0, 0, 0}
};
static int ether_filter_len = sizeof (ether_filter) / sizeof (short);