]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - net/ipv6/netfilter/ip6t_eui64.c
1 /* Kernel module to match EUI64 address parameters. */
3 /* (C) 2001-2002 Andras Kis-Szabo <kisza@sch.bme.hu>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/module.h>
11 #include <linux/skbuff.h>
12 #include <linux/ipv6.h>
13 #include <linux/if_ether.h>
15 #include <linux/netfilter_ipv6/ip6_tables.h>
17 MODULE_DESCRIPTION("IPv6 EUI64 address checking match");
18 MODULE_LICENSE("GPL");
19 MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
22 match(const struct sk_buff
*skb
,
23 const struct net_device
*in
,
24 const struct net_device
*out
,
25 const void *matchinfo
,
31 unsigned char eui64
[8];
34 if ( !(skb
->mac
.raw
>= skb
->head
35 && (skb
->mac
.raw
+ ETH_HLEN
) <= skb
->data
)
41 memset(eui64
, 0, sizeof(eui64
));
43 if (eth_hdr(skb
)->h_proto
== ntohs(ETH_P_IPV6
)) {
44 if (skb
->nh
.ipv6h
->version
== 0x6) {
45 memcpy(eui64
, eth_hdr(skb
)->h_source
, 3);
46 memcpy(eui64
+ 5, eth_hdr(skb
)->h_source
+ 3, 3);
52 while ((skb
->nh
.ipv6h
->saddr
.s6_addr
[8+i
] ==
53 eui64
[i
]) && (i
<8)) i
++;
64 ip6t_eui64_checkentry(const char *tablename
,
65 const struct ip6t_ip6
*ip
,
67 unsigned int matchsize
,
68 unsigned int hook_mask
)
71 & ~((1 << NF_IP6_PRE_ROUTING
) | (1 << NF_IP6_LOCAL_IN
) |
72 (1 << NF_IP6_FORWARD
))) {
73 printk("ip6t_eui64: only valid for PRE_ROUTING, LOCAL_IN or FORWARD.\n");
77 if (matchsize
!= IP6T_ALIGN(sizeof(int)))
83 static struct ip6t_match eui64_match
= {
86 .checkentry
= &ip6t_eui64_checkentry
,
90 static int __init
init(void)
92 return ip6t_register_match(&eui64_match
);
95 static void __exit
fini(void)
97 ip6t_unregister_match(&eui64_match
);