On Fri, Jul 11, 2014 at 3:05 PM, Daniele Di Proietto
<ddiproie...@vmware.com> wrote:
> If the userspace wants to match on a flow with tun_key.{tun_id, tun_flags,
> ipv4_tos} set to 0 it simply omits them in the netlink attributes stream.
> Since our wildcarding logic (when megaflows are disabled) is based on the
> attributes in the netlink stream, we set our mask incorrectly.
>
> This commit adds a check to detect if the userspace wants to match on a 
> tunnel,
> in which case we simply unwildcard tun_key.{tun_id, tun_flags, ipv4_tos}
>
> Reported-by: Andy Zhou <az...@nicira.com>
> Signed-off-by: Daniele Di Proietto <ddiproie...@vmware.com>
> ---
>  datapath/flow_netlink.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
> index 5f975a1..13b55be 100644
> --- a/datapath/flow_netlink.c
> +++ b/datapath/flow_netlink.c
> @@ -912,6 +912,17 @@ int ovs_nla_get_match(struct sw_flow_match *match,
>
>                 mask_set_nlattr(newmask, 0xff);
>
> +               /* The userspace does not send tunnel attributes that are 0,
> +                * but we should not wildcard them nonetheless. */
> +               if (match->key->tun_key.ipv4_dst) {
> +                       SW_FLOW_KEY_PUT(match, tun_key.tun_id,
> +                                       cpu_to_be64(0xffffffffffffffffULL),
> +                                       true);
> +                       SW_FLOW_KEY_PUT(match, tun_key.tun_flags,
> +                                       htons(0xffff), true);
> +                       SW_FLOW_KEY_PUT(match, tun_key.ipv4_tos, 0xff, true);
> +               }
> +

Why not just set 0xff to the entire tun_key so it is easier to
understand and more robust.

>                 mask = newmask;
>         }
>
> --
> 2.0.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to