5 * Chris Vitale csv@bluetail.com
11 #include <linux/netfilter_bridge/ebtables.h>
12 #include <linux/netfilter_bridge/ebt_802_3.h>
13 #include <linux/module.h>
15 static int ebt_filter_802_3(const struct sk_buff
*skb
, const struct net_device
*in
,
16 const struct net_device
*out
, const void *data
, unsigned int datalen
)
18 struct ebt_802_3_info
*info
= (struct ebt_802_3_info
*)data
;
19 struct ebt_802_3_hdr
*hdr
= ebt_802_3_hdr(skb
);
20 uint16_t 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 struct ebt_match filter_802_3
;
40 static int ebt_802_3_check(const char *tablename
, unsigned int hookmask
,
41 const struct ebt_entry
*e
, void *data
, unsigned int datalen
)
43 struct ebt_802_3_info
*info
= (struct ebt_802_3_info
*)data
;
45 if (datalen
< sizeof(struct ebt_802_3_info
))
47 if (info
->bitmask
& ~EBT_802_3_MASK
|| info
->invflags
& ~EBT_802_3_MASK
)
53 static struct ebt_match filter_802_3
=
55 .name
= EBT_802_3_MATCH
,
56 .match
= ebt_filter_802_3
,
57 .check
= ebt_802_3_check
,
61 static int __init
ebt_802_3_init(void)
63 return ebt_register_match(&filter_802_3
);
66 static void __exit
ebt_802_3_fini(void)
68 ebt_unregister_match(&filter_802_3
);
71 module_init(ebt_802_3_init
);
72 module_exit(ebt_802_3_fini
);
73 MODULE_LICENSE("GPL");
This page took 0.039628 seconds and 5 git commands to generate.