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_mark_m.h>
16 ebt_mark_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, bool *hotdrop)
20 const struct ebt_mark_m_info *info = data;
22 if (info->bitmask & EBT_MARK_OR)
23 return !!(skb->mark & info->mask) ^ info->invert;
24 return ((skb->mark & info->mask) == info->mark) ^ info->invert;
28 ebt_mark_mt_check(const char *table, const void *e,
29 const struct xt_match *match, void *data,
30 unsigned int hook_mask)
32 const struct ebt_mark_m_info *info = data;
34 if (info->bitmask & ~EBT_MARK_MASK)
36 if ((info->bitmask & EBT_MARK_OR) && (info->bitmask & EBT_MARK_AND))
43 static struct xt_match ebt_mark_mt_reg __read_mostly = {
46 .family = NFPROTO_BRIDGE,
48 .checkentry = ebt_mark_mt_check,
49 .matchsize = XT_ALIGN(sizeof(struct ebt_mark_m_info)),
53 static int __init ebt_mark_m_init(void)
55 return xt_register_match(&ebt_mark_mt_reg);
58 static void __exit ebt_mark_m_fini(void)
60 xt_unregister_match(&ebt_mark_mt_reg);
63 module_init(ebt_mark_m_init);
64 module_exit(ebt_mark_m_fini);
65 MODULE_DESCRIPTION("Ebtables: Packet mark match");
66 MODULE_LICENSE("GPL");