X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fbridge%2Fnetfilter%2Febt_vlan.c;h=7ee377622964d46e1bb57687c6af01587fe37fa3;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=ec111772bbe91bc9d34251b66747b95275d0c6c3;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c index ec111772b..7ee377622 100644 --- a/net/bridge/netfilter/ebt_vlan.c +++ b/net/bridge/netfilter/ebt_vlan.c @@ -21,13 +21,14 @@ #include #include #include +#include #include #include -static unsigned char debug; +static int debug; #define MODULE_VERS "0.6" -MODULE_PARM(debug, "0-1b"); +module_param(debug, int, 0); MODULE_PARM_DESC(debug, "debug=1 is turn on debug messages"); MODULE_AUTHOR("Nick Fedchik "); MODULE_DESCRIPTION("802.1Q match module (ebtables extension), v" @@ -48,15 +49,16 @@ ebt_filter_vlan(const struct sk_buff *skb, const void *data, unsigned int datalen) { struct ebt_vlan_info *info = (struct ebt_vlan_info *) data; - struct vlan_hdr frame; + struct vlan_hdr _frame, *fp; unsigned short TCI; /* Whole TCI, given from parsed frame */ unsigned short id; /* VLAN ID, given from frame TCI */ unsigned char prio; /* user_priority, given from frame TCI */ /* VLAN encapsulated Type/Length field, given from orig frame */ - unsigned short encap; + __be16 encap; - if (skb_copy_bits(skb, 0, &frame, sizeof(frame))) + fp = skb_header_pointer(skb, 0, sizeof(_frame), &_frame); + if (fp == NULL) return EBT_NOMATCH; /* Tag Control Information (TCI) consists of the following elements: @@ -66,10 +68,10 @@ ebt_filter_vlan(const struct sk_buff *skb, * (CFI) is a single bit flag value. Currently ignored. * - VLAN Identifier (VID). The VID is encoded as * an unsigned binary number. */ - TCI = ntohs(frame.h_vlan_TCI); + TCI = ntohs(fp->h_vlan_TCI); id = TCI & VLAN_VID_MASK; prio = (TCI >> 13) & 0x7; - encap = frame.h_vlan_encapsulated_proto; + encap = fp->h_vlan_encapsulated_proto; /* Checking VLAN Identifier (VID) */ if (GET_BITMASK(EBT_VLAN_ID)) @@ -102,7 +104,7 @@ ebt_check_vlan(const char *tablename, } /* Is it 802.1Q frame checked? */ - if (e->ethproto != __constant_htons(ETH_P_8021Q)) { + if (e->ethproto != htons(ETH_P_8021Q)) { DEBUG_MSG ("passed entry proto %2.4X is not 802.1Q (8100)\n", (unsigned short) ntohs(e->ethproto)); @@ -176,7 +178,7 @@ static struct ebt_match filter_vlan = { .me = THIS_MODULE, }; -static int __init init(void) +static int __init ebt_vlan_init(void) { DEBUG_MSG("ebtables 802.1Q extension module v" MODULE_VERS "\n"); @@ -184,10 +186,10 @@ static int __init init(void) return ebt_register_match(&filter_vlan); } -static void __exit fini(void) +static void __exit ebt_vlan_fini(void) { ebt_unregister_match(&filter_vlan); } -module_init(init); -module_exit(fini); +module_init(ebt_vlan_init); +module_exit(ebt_vlan_fini);