[NET]: Some more missing include/etherdevice.h includes
[deliverable/linux.git] / net / ipv6 / netfilter / ip6t_mac.c
1 /* Kernel module to match MAC address parameters. */
2
3 /* (C) 1999-2001 Paul `Rusty' Russell
4 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11 #include <linux/module.h>
12 #include <linux/skbuff.h>
13 #include <linux/if_ether.h>
14 #include <linux/etherdevice.h>
15
16 #include <linux/netfilter_ipv6/ip6t_mac.h>
17 #include <linux/netfilter_ipv6/ip6_tables.h>
18
19 MODULE_LICENSE("GPL");
20 MODULE_DESCRIPTION("MAC address matching module for IPv6");
21 MODULE_AUTHOR("Netfilter Core Teaam <coreteam@netfilter.org>");
22
23 static int
24 match(const struct sk_buff *skb,
25 const struct net_device *in,
26 const struct net_device *out,
27 const void *matchinfo,
28 int offset,
29 unsigned int protoff,
30 int *hotdrop)
31 {
32 const struct ip6t_mac_info *info = matchinfo;
33
34 /* Is mac pointer valid? */
35 return (skb->mac.raw >= skb->head
36 && (skb->mac.raw + ETH_HLEN) <= skb->data
37 /* If so, compare... */
38 && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))
39 ^ info->invert));
40 }
41
42 static int
43 ip6t_mac_checkentry(const char *tablename,
44 const struct ip6t_ip6 *ip,
45 void *matchinfo,
46 unsigned int matchsize,
47 unsigned int hook_mask)
48 {
49 if (hook_mask
50 & ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN)
51 | (1 << NF_IP6_FORWARD))) {
52 printk("ip6t_mac: only valid for PRE_ROUTING, LOCAL_IN or"
53 " FORWARD\n");
54 return 0;
55 }
56
57 if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_mac_info)))
58 return 0;
59
60 return 1;
61 }
62
63 static struct ip6t_match mac_match = {
64 .name = "mac",
65 .match = &match,
66 .checkentry = &ip6t_mac_checkentry,
67 .me = THIS_MODULE,
68 };
69
70 static int __init init(void)
71 {
72 return ip6t_register_match(&mac_match);
73 }
74
75 static void __exit fini(void)
76 {
77 ip6t_unregister_match(&mac_match);
78 }
79
80 module_init(init);
81 module_exit(fini);
This page took 0.07054 seconds and 5 git commands to generate.