netfilter: xtables: move extension arguments into compound structure (1/6)
[deliverable/linux.git] / net / bridge / netfilter / ebt_pkttype.c
1 /*
2 * ebt_pkttype
3 *
4 * Authors:
5 * Bart De Schuymer <bdschuym@pandora.be>
6 *
7 * April, 2003
8 *
9 */
10 #include <linux/module.h>
11 #include <linux/netfilter/x_tables.h>
12 #include <linux/netfilter_bridge/ebtables.h>
13 #include <linux/netfilter_bridge/ebt_pkttype.h>
14
15 static bool
16 ebt_pkttype_mt(const struct sk_buff *skb, const struct xt_match_param *par)
17 {
18 const struct ebt_pkttype_info *info = par->matchinfo;
19
20 return (skb->pkt_type == info->pkt_type) ^ info->invert;
21 }
22
23 static bool
24 ebt_pkttype_mt_check(const char *table, const void *e,
25 const struct xt_match *match, void *data,
26 unsigned int hook_mask)
27 {
28 const struct ebt_pkttype_info *info = data;
29
30 if (info->invert != 0 && info->invert != 1)
31 return false;
32 /* Allow any pkt_type value */
33 return true;
34 }
35
36 static struct xt_match ebt_pkttype_mt_reg __read_mostly = {
37 .name = "pkttype",
38 .revision = 0,
39 .family = NFPROTO_BRIDGE,
40 .match = ebt_pkttype_mt,
41 .checkentry = ebt_pkttype_mt_check,
42 .matchsize = XT_ALIGN(sizeof(struct ebt_pkttype_info)),
43 .me = THIS_MODULE,
44 };
45
46 static int __init ebt_pkttype_init(void)
47 {
48 return xt_register_match(&ebt_pkttype_mt_reg);
49 }
50
51 static void __exit ebt_pkttype_fini(void)
52 {
53 xt_unregister_match(&ebt_pkttype_mt_reg);
54 }
55
56 module_init(ebt_pkttype_init);
57 module_exit(ebt_pkttype_fini);
58 MODULE_DESCRIPTION("Ebtables: Link layer packet type match");
59 MODULE_LICENSE("GPL");
This page took 0.031881 seconds and 5 git commands to generate.