]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - net/bridge/netfilter/ebt_vlan.c
[NETFILTER]: ebtables: remove casts, use consts
[mirror_ubuntu-zesty-kernel.git] / net / bridge / netfilter / ebt_vlan.c
index a2b452862b73d5cb42d652644f2cac1017bb68d9..097d06701e49a165ac11c7d40ad99fb6d094d8eb 100644 (file)
@@ -37,9 +37,7 @@ MODULE_LICENSE("GPL");
 
 
 #define DEBUG_MSG(args...) if (debug) printk (KERN_DEBUG "ebt_vlan: " args)
-#define INV_FLAG(_inv_flag_) (info->invflags & _inv_flag_) ? "!" : ""
 #define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_
-#define SET_BITMASK(_BIT_MASK_) info->bitmask |= _BIT_MASK_
 #define EXIT_ON_MISMATCH(_MATCH_,_MASK_) {if (!((info->_MATCH_ == _MATCH_)^!!(info->invflags & _MASK_))) return EBT_NOMATCH;}
 
 static int
@@ -48,14 +46,15 @@ ebt_filter_vlan(const struct sk_buff *skb,
                const struct net_device *out,
                const void *data, unsigned int datalen)
 {
-       struct ebt_vlan_info *info = (struct ebt_vlan_info *) data;
-       struct vlan_hdr _frame, *fp;
+       const struct ebt_vlan_info *info = data;
+       const struct vlan_hdr *fp;
+       struct vlan_hdr _frame;
 
        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;
 
        fp = skb_header_pointer(skb, 0, sizeof(_frame), &_frame);
        if (fp == NULL)
@@ -93,7 +92,7 @@ ebt_check_vlan(const char *tablename,
               unsigned int hooknr,
               const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_vlan_info *info = (struct ebt_vlan_info *) data;
+       struct ebt_vlan_info *info = data;
 
        /* Parameters buffer overflow check */
        if (datalen != EBT_ALIGN(sizeof(struct ebt_vlan_info))) {
@@ -128,9 +127,9 @@ ebt_check_vlan(const char *tablename,
 
        /* Reserved VLAN ID (VID) values
         * -----------------------------
-        * 0 - The null VLAN ID. 
+        * 0 - The null VLAN ID.
         * 1 - The default Port VID (PVID)
-        * 0x0FFF - Reserved for implementation use. 
+        * 0x0FFF - Reserved for implementation use.
         * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */
        if (GET_BITMASK(EBT_VLAN_ID)) {
                if (!!info->id) { /* if id!=0 => check vid range */
@@ -141,7 +140,7 @@ ebt_check_vlan(const char *tablename,
                                return -EINVAL;
                        }
                        /* Note: This is valid VLAN-tagged frame point.
-                        * Any value of user_priority are acceptable, 
+                        * Any value of user_priority are acceptable,
                         * but should be ignored according to 802.1Q Std.
                         * So we just drop the prio flag. */
                        info->bitmask &= ~EBT_VLAN_PRIO;