From a4fbb689b03ad18651ee119ba5ce0ff8cf8d95b5 Mon Sep 17 00:00:00 2001 From: Jean Tourrilhes Date: Thu, 8 Oct 2009 10:37:43 -0700 Subject: [PATCH] datapath: Fix validation of ODPAT_SET_VLAN_PCP actions. The VLAN PCP mask is in the rightmost bits of the vlan_pcp member but we were checking for it in its position in the VLAN tag field instead. Slightly modified from Jean's original patch by adding and using the VLAN_PCP_SHIFT macro. --- datapath/datapath.c | 3 ++- datapath/datapath.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index b0dbe7fc2..e0b0e2c26 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -783,7 +783,8 @@ static int validate_actions(const struct sw_flow_actions *actions) break; case ODPAT_SET_VLAN_PCP: - if (a->vlan_pcp.vlan_pcp & ~VLAN_PCP_MASK) + if (a->vlan_pcp.vlan_pcp + & ~(VLAN_PCP_MASK >> VLAN_PCP_SHIFT)) return -EINVAL; break; diff --git a/datapath/datapath.h b/datapath/datapath.h index eee1bbfc5..88bdbc657 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -24,6 +24,7 @@ /* Mask for the priority bits in a vlan header. If we ever merge upstream * then this should go into include/linux/if_vlan.h. */ #define VLAN_PCP_MASK 0xe000 +#define VLAN_PCP_SHIFT 13 #define DP_MAX_PORTS 1024 #define DP_MAX_GROUPS 16 -- 2.43.0