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
;
23 static bool ebt_pkttype_mt_check(const struct xt_mtchk_param
*par
)
25 const struct ebt_pkttype_info
*info
= par
->matchinfo
;
27 if (info
->invert
!= 0 && info
->invert
!= 1)
29 /* Allow any pkt_type value */
33 static struct xt_match ebt_pkttype_mt_reg __read_mostly
= {
36 .family
= NFPROTO_BRIDGE
,
37 .match
= ebt_pkttype_mt
,
38 .checkentry
= ebt_pkttype_mt_check
,
39 .matchsize
= XT_ALIGN(sizeof(struct ebt_pkttype_info
)),
43 static int __init
ebt_pkttype_init(void)
45 return xt_register_match(&ebt_pkttype_mt_reg
);
48 static void __exit
ebt_pkttype_fini(void)
50 xt_unregister_match(&ebt_pkttype_mt_reg
);
53 module_init(ebt_pkttype_init
);
54 module_exit(ebt_pkttype_fini
);
55 MODULE_DESCRIPTION("Ebtables: Link layer packet type match");
56 MODULE_LICENSE("GPL");