dpif-netdev: Fix validation of VLAN PCP value in userspace datapath.
authorBen Pfaff <blp@nicira.com>
Thu, 11 Feb 2010 21:51:56 +0000 (13:51 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 12 Feb 2010 21:55:46 +0000 (13:55 -0800)
Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
lib/dpif-netdev.c
lib/packets.h

index e9f006c3479978ab43f63de6c4c35e6c90f62d3e..1daa93b299aa53f64d05b9ff3ff940669e07c727 100644 (file)
@@ -752,7 +752,7 @@ dpif_netdev_validate_actions(const union odp_action *actions, int n_actions,
 
                case ODPAT_SET_VLAN_PCP:
             *mutates = true;
-                       if (a->vlan_pcp.vlan_pcp & ~VLAN_PCP_MASK) {
+                       if (a->vlan_pcp.vlan_pcp & ~(VLAN_PCP_MASK >> VLAN_PCP_SHIFT)) {
                                return EINVAL;
             }
                        break;
index 2c33078f2bbf3f479041cc6b3a44347f6ab77f1a..f0ccfdb9e90f2b2be16af1a67d14d71072d9a936 100644 (file)
@@ -179,7 +179,10 @@ struct llc_snap_header {
 BUILD_ASSERT_DECL(LLC_SNAP_HEADER_LEN == sizeof(struct llc_snap_header));
 
 #define VLAN_VID_MASK 0x0fff
+#define VLAN_VID_SHIFT 0
+
 #define VLAN_PCP_MASK 0xe000
+#define VLAN_PCP_SHIFT 13
 
 #define VLAN_HEADER_LEN 4
 struct vlan_header {