1 // SPDX-License-Identifier: GPL-2.0-only
6 * Bart De Schuymer <bdschuym@pandora.be>
11 #include <linux/module.h>
12 #include <linux/netfilter/x_tables.h>
13 #include <linux/netfilter_bridge/ebtables.h>
14 #include <linux/netfilter_bridge/ebt_pkttype.h>
17 ebt_pkttype_mt(const struct sk_buff *skb, struct xt_action_param *par)
19 const struct ebt_pkttype_info *info = par->matchinfo;
21 return (skb->pkt_type == info->pkt_type) ^ info->invert;
24 static int ebt_pkttype_mt_check(const struct xt_mtchk_param *par)
26 const struct ebt_pkttype_info *info = par->matchinfo;
28 if (info->invert != 0 && info->invert != 1)
30 /* Allow any pkt_type value */
34 static struct xt_match ebt_pkttype_mt_reg __read_mostly = {
37 .family = NFPROTO_BRIDGE,
38 .match = ebt_pkttype_mt,
39 .checkentry = ebt_pkttype_mt_check,
40 .matchsize = sizeof(struct ebt_pkttype_info),
44 static int __init ebt_pkttype_init(void)
46 return xt_register_match(&ebt_pkttype_mt_reg);
49 static void __exit ebt_pkttype_fini(void)
51 xt_unregister_match(&ebt_pkttype_mt_reg);
54 module_init(ebt_pkttype_init);
55 module_exit(ebt_pkttype_fini);
56 MODULE_DESCRIPTION("Ebtables: Link layer packet type match");
57 MODULE_LICENSE("GPL");