On Thu, Aug 1, 2013 at 10:49 AM, Andy Zhou <az...@nicira.com> wrote:
> When key.eth_type is absent it is interpreted to be 802.2. In this
> case, the eth_type mask, if supplied, will be overridden to be exact
> match, regardless of the value supplied.
>
> Signed-off-by: Andy Zhou <az...@nicira.com>
> ---
>  datapath/flow.c |   13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/datapath/flow.c b/datapath/flow.c
> index 5aac1f9..47f81b9 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -137,11 +137,8 @@ static bool ovs_match_validate(const struct 
> sw_flow_match *match,
>
>         /* Always allowed mask fields. */
>         mask_allowed |= ((1ULL << OVS_KEY_ATTR_TUNNEL)
> -                        | (1ULL << OVS_KEY_ATTR_IN_PORT));
> -
> -       if (match->key->eth.type == htons(ETH_P_802_2) &&
> -           match->mask && (match->mask->key.eth.type == htons(0xffff)))
> -               mask_allowed |= (1ULL << OVS_KEY_ATTR_ETHERTYPE);
> +                       | (1ULL << OVS_KEY_ATTR_IN_PORT)
> +                       | (11ULL << OVS_KEY_ATTR_ETHERTYPE));
>
>         /* Check key attributes. */
>         if (match->key->eth.type == htons(ETH_P_ARP)
> @@ -1386,7 +1383,11 @@ static int ovs_key_from_nlattrs(struct sw_flow_match 
> *match,  u64 attrs,
>                 __be16 eth_type;
>
>                 eth_type = nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE]);
> -               if (!is_mask && ntohs(eth_type) < ETH_P_802_3_MIN) {
> +               if (is_mask) {
> +                       if (match->key->eth.type == htons(ETH_P_802_2))
> +                               /* Always exact match 802.2 ether type. */
> +                               eth_type = htons(0xffff);

I applied this one as well but I dropped the check for the type being
ETH_P_802_2 since if any flow has a mask then it might potentially hit
the special value (this is the same as the input port).
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to