On Jul 11, 2014, at 4:11 PM, Andy Zhou <az...@nicira.com> wrote: > 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. >
Sure, if you think it’s better. I’m about to post v2. Thanks, Daniele >> mask = newmask; >> } >> >> -- >> 2.0.0 >> >> _______________________________________________ >> dev mailing list >> dev@openvswitch.org >> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=WPe6JliVOjcciBDW1sw8BdZueRs3HJklNqAxJogdcFs%3D%0A&s=d8ecb1242918fd3451b8451322c2b535dbb716f1ad634d810aff8885143dfbe4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev