5 * Bart De Schuymer <bdschuym@pandora.be>
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>
16 ebt_pkttype_mt(const struct sk_buff
*skb
, const struct xt_match_param
*par
)
18 const struct ebt_pkttype_info
*info
= par
->matchinfo
;
20 return (skb
->pkt_type
== info
->pkt_type
) ^ info
->invert
;
24 ebt_pkttype_mt_check(const char *table
, const void *e
,
25 const struct xt_match
*match
, void *data
,
26 unsigned int hook_mask
)
28 const struct ebt_pkttype_info
*info
= data
;
30 if (info
->invert
!= 0 && info
->invert
!= 1)
32 /* Allow any pkt_type value */
36 static struct xt_match ebt_pkttype_mt_reg __read_mostly
= {
39 .family
= NFPROTO_BRIDGE
,
40 .match
= ebt_pkttype_mt
,
41 .checkentry
= ebt_pkttype_mt_check
,
42 .matchsize
= XT_ALIGN(sizeof(struct ebt_pkttype_info
)),
46 static int __init
ebt_pkttype_init(void)
48 return xt_register_match(&ebt_pkttype_mt_reg
);
51 static void __exit
ebt_pkttype_fini(void)
53 xt_unregister_match(&ebt_pkttype_mt_reg
);
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");