5 * Chris Vitale csv@bluetail.com
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_802_3.h>
16 ebt_802_3_mt(const struct sk_buff
*skb
, const struct xt_action_param
*par
)
18 const struct ebt_802_3_info
*info
= par
->matchinfo
;
19 const struct ebt_802_3_hdr
*hdr
= ebt_802_3_hdr(skb
);
20 __be16 type
= hdr
->llc
.ui
.ctrl
& IS_UI
? hdr
->llc
.ui
.type
: hdr
->llc
.ni
.type
;
22 if (info
->bitmask
& EBT_802_3_SAP
) {
23 if (FWINV(info
->sap
!= hdr
->llc
.ui
.ssap
, EBT_802_3_SAP
))
25 if (FWINV(info
->sap
!= hdr
->llc
.ui
.dsap
, EBT_802_3_SAP
))
29 if (info
->bitmask
& EBT_802_3_TYPE
) {
30 if (!(hdr
->llc
.ui
.dsap
== CHECK_TYPE
&& hdr
->llc
.ui
.ssap
== CHECK_TYPE
))
32 if (FWINV(info
->type
!= type
, EBT_802_3_TYPE
))
39 static int ebt_802_3_mt_check(const struct xt_mtchk_param
*par
)
41 const struct ebt_802_3_info
*info
= par
->matchinfo
;
43 if (info
->bitmask
& ~EBT_802_3_MASK
|| info
->invflags
& ~EBT_802_3_MASK
)
49 static struct xt_match ebt_802_3_mt_reg __read_mostly
= {
52 .family
= NFPROTO_BRIDGE
,
53 .match
= ebt_802_3_mt
,
54 .checkentry
= ebt_802_3_mt_check
,
55 .matchsize
= sizeof(struct ebt_802_3_info
),
59 static int __init
ebt_802_3_init(void)
61 return xt_register_match(&ebt_802_3_mt_reg
);
64 static void __exit
ebt_802_3_fini(void)
66 xt_unregister_match(&ebt_802_3_mt_reg
);
69 module_init(ebt_802_3_init
);
70 module_exit(ebt_802_3_fini
);
71 MODULE_DESCRIPTION("Ebtables: DSAP/SSAP field and SNAP type matching");
72 MODULE_LICENSE("GPL");