2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif-netdev: Add vlan to mask for flow_put operation.

Datapath flows in dpif-netdev classifier always has exact match
mask set for vlan. We have to enable it for flow_put operation
too in order to avoid flow modification failure due to
classifier lookup with wrong hash.

Found by OFtest.

CC: Jan Scheurich <jan.scheurich@ericsson.com>
Fixes: beb75a40fd ("userspace: Switching of L3 packets in L2 pipeline")
Reported-by: Ben Pfaff <blp@ovn.org>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-September/352579.html
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ilya Maximets
2018-10-09 19:15:13 +03:00
committed by Ben Pfaff
parent d348d03e67
commit 35fe9efb2f

View File

@@ -3374,6 +3374,16 @@ dpif_netdev_flow_put(struct dpif *dpif, const struct dpif_flow_put *put)
dpif_flow_hash(dpif, &match.flow, sizeof match.flow, &ufid); dpif_flow_hash(dpif, &match.flow, sizeof match.flow, &ufid);
} }
/* The Netlink encoding of datapath flow keys cannot express
* wildcarding the presence of a VLAN tag. Instead, a missing VLAN
* tag is interpreted as exact match on the fact that there is no
* VLAN. Unless we refactor a lot of code that translates between
* Netlink and struct flow representations, we have to do the same
* here. This must be in sync with 'match' in handle_packet_upcall(). */
if (!match.wc.masks.vlans[0].tci) {
match.wc.masks.vlans[0].tci = htons(0xffff);
}
/* Must produce a netdev_flow_key for lookup. /* Must produce a netdev_flow_key for lookup.
* Use the same method as employed to create the key when adding * Use the same method as employed to create the key when adding
* the flow to the dplcs to make sure they match. */ * the flow to the dplcs to make sure they match. */
@@ -6089,7 +6099,7 @@ handle_packet_upcall(struct dp_netdev_pmd_thread *pmd,
* tag is interpreted as exact match on the fact that there is no * tag is interpreted as exact match on the fact that there is no
* VLAN. Unless we refactor a lot of code that translates between * VLAN. Unless we refactor a lot of code that translates between
* Netlink and struct flow representations, we have to do the same * Netlink and struct flow representations, we have to do the same
* here. */ * here. This must be in sync with 'match' in dpif_netdev_flow_put(). */
if (!match.wc.masks.vlans[0].tci) { if (!match.wc.masks.vlans[0].tci) {
match.wc.masks.vlans[0].tci = htons(0xffff); match.wc.masks.vlans[0].tci = htons(0xffff);
} }