5 * Bart De Schuymer <bdschuym@pandora.be>
11 #include <linux/netfilter_bridge/ebtables.h>
12 #include <linux/netfilter_bridge/ebt_pkttype.h>
13 #include <linux/module.h>
15 static int ebt_filter_pkttype(const struct sk_buff *skb,
16 const struct net_device *in,
17 const struct net_device *out,
21 const struct ebt_pkttype_info *info = data;
23 return (skb->pkt_type != info->pkt_type) ^ info->invert;
26 static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
27 const struct ebt_entry *e, void *data, unsigned int datalen)
29 const struct ebt_pkttype_info *info = data;
31 if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info)))
33 if (info->invert != 0 && info->invert != 1)
35 /* Allow any pkt_type value */
39 static struct ebt_match filter_pkttype __read_mostly = {
40 .name = EBT_PKTTYPE_MATCH,
41 .match = ebt_filter_pkttype,
42 .check = ebt_pkttype_check,
46 static int __init ebt_pkttype_init(void)
48 return ebt_register_match(&filter_pkttype);
51 static void __exit ebt_pkttype_fini(void)
53 ebt_unregister_match(&filter_pkttype);
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");