summaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-24 00:11:07 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-24 00:11:07 +0100
commit8b5177c4e88699442b8de493bff5273f235caa9b (patch)
treeb8fbc96a7f6dc080587574d8a1383fa284f47cfd /pfinet
parentc48e6ec36da97d514488f88fa4b9c268fd0d6284 (diff)
Enable IPv6 packets between netdde and pfinet
* pfinet/ethernet.c (bpf_ether_filter): Make rules more readable. Add rule to enable IPv6 frames.
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/ethernet.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c
index 447d5b06..dfc2c114 100644
--- a/pfinet/ethernet.c
+++ b/pfinet/ethernet.c
@@ -83,15 +83,15 @@ static short ether_filter[] =
};
static int ether_filter_len = sizeof (ether_filter) / sizeof (short);
-/* The BPF instruction allows IP and ARP packets */
static struct bpf_insn bpf_ether_filter[] =
{
- {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},
+ {NETF_IN|NETF_BPF, 0, 0, 0}, /* Header. */
+ {BPF_LD|BPF_H|BPF_ABS, 0, 0, 12}, /* Load Ethernet type */
+ {BPF_JMP|BPF_JEQ|BPF_K, 2, 0, 0x0806}, /* Accept ARP */
+ {BPF_JMP|BPF_JEQ|BPF_K, 1, 0, 0x0800}, /* Accept IPv4 */
+ {BPF_JMP|BPF_JEQ|BPF_K, 0, 1, 0x86DD}, /* Accept IPv6 */
+ {BPF_RET|BPF_K, 0, 0, 1500}, /* And return 1500 bytes */
+ {BPF_RET|BPF_K, 0, 0, 0}, /* Or discard it all */
};
static int bpf_ether_filter_len = sizeof (bpf_ether_filter) / sizeof (short);