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