From: Jean Tourrilhes Date: Thu, 8 Oct 2009 17:37:43 +0000 (-0700) Subject: datapath: Fix validation of ODPAT_SET_VLAN_PCP actions. X-Git-Tag: v0.90.7~50 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=a4fbb689b03ad18651ee119ba5ce0ff8cf8d95b5;p=cascardo%2Fovs.git 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. --- 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