X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fflow.c;h=d899d260d6a29a8c580e61f334caa73b34e3c6a3;hb=016953ae96bebb3d3c421757d1f98b9966433bd1;hp=a42fea1e3d0f3113b0959b6f80cae9e25312642a;hpb=7431e17196fdb1c3189d67e3aeed4adeab4cf479;p=sliver-openvswitch.git diff --git a/lib/flow.c b/lib/flow.c index a42fea1e3..d899d260d 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -781,7 +781,8 @@ flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis) /* Masks the fields in 'wc' that are used by the flow hash 'fields'. */ void -flow_mask_hash_fields(struct flow_wildcards *wc, enum nx_hash_fields fields) +flow_mask_hash_fields(const struct flow *flow, struct flow_wildcards *wc, + enum nx_hash_fields fields) { switch (fields) { case NX_HASH_FIELDS_ETH_SRC: @@ -791,11 +792,18 @@ flow_mask_hash_fields(struct flow_wildcards *wc, enum nx_hash_fields fields) case NX_HASH_FIELDS_SYMMETRIC_L4: memset(&wc->masks.dl_src, 0xff, sizeof wc->masks.dl_src); memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst); - memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); - memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src); - memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst); - memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src); - memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst); + if (flow->dl_type == htons(ETH_TYPE_IP)) { + memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src); + memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst); + } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) { + memset(&wc->masks.ipv6_src, 0xff, sizeof wc->masks.ipv6_src); + memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst); + } + if (is_ip_any(flow)) { + memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto); + memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src); + memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst); + } wc->masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI); break;