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 net_device *in,
17 const struct net_device *out, const struct xt_match *match,
18 const void *data, int offset, unsigned int protoff,
21 const struct ebt_pkttype_info *info = data;
23 return (skb->pkt_type == info->pkt_type) ^ info->invert;
27 ebt_pkttype_mt_check(const char *table, const void *e,
28 const struct xt_match *match, void *data,
29 unsigned int hook_mask)
31 const struct ebt_pkttype_info *info = data;
33 if (info->invert != 0 && info->invert != 1)
35 /* Allow any pkt_type value */
39 static struct xt_match ebt_pkttype_mt_reg __read_mostly = {
42 .family = NFPROTO_BRIDGE,
43 .match = ebt_pkttype_mt,
44 .checkentry = ebt_pkttype_mt_check,
45 .matchsize = XT_ALIGN(sizeof(struct ebt_pkttype_info)),
49 static int __init ebt_pkttype_init(void)
51 return xt_register_match(&ebt_pkttype_mt_reg);
54 static void __exit ebt_pkttype_fini(void)
56 xt_unregister_match(&ebt_pkttype_mt_reg);
59 module_init(ebt_pkttype_init);
60 module_exit(ebt_pkttype_fini);
61 MODULE_DESCRIPTION("Ebtables: Link layer packet type match");
62 MODULE_LICENSE("GPL");