datapath: Set only VID when adding a new header with ODPAT_SET_VLAN_VID.
authorBen Pfaff <blp@nicira.com>
Wed, 15 Apr 2009 17:50:08 +0000 (10:50 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 15 Apr 2009 17:50:08 +0000 (10:50 -0700)
ODPAT_SET_VLAN_VID is supposed to set only the VID field of the VLAN
header.  When it was only modifying an existing VLAN header, it was doing
this correctly.  However, when it added a new header, it added all of the
bits passed in as the argument, not just the VID field.  Fix this, setting
the other bits to 0 implicitly.

Also fixes the analogous problem with ODPAT_SET_VLAN_PCP.

datapath/actions.c

index 717c0582a9c0e6e91c74f32265787253ce65a490..17527931e7e6ad7a122a2ec868a442ae962ef0d2 100644 (file)
@@ -80,7 +80,7 @@ modify_vlan_tci(struct sk_buff *skb, struct odp_flow_key *key,
                 * xxx version.  We'll directly use the software version
                 * xxx until the problem can be diagnosed.
                 */
-               skb = __vlan_put_tag(skb, tci);
+               skb = __vlan_put_tag(skb, tci & mask);
                if (!skb)
                        return NULL;
                vh = vlan_eth_hdr(skb);