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.
CC: Jan Scheurich <[email protected]> Fixes: beb75a40fdc2 ("userspace: Switching of L3 packets in L2 pipeline") Reported-by: Ben Pfaff <[email protected]> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-September/352579.html Signed-off-by: Ilya Maximets <[email protected]> --- lib/dpif-netdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index e322f5553..5df4129fb 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -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); } + /* 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. * Use the same method as employed to create the key when adding * 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 * VLAN. Unless we refactor a lot of code that translates between * 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) { match.wc.masks.vlans[0].tci = htons(0xffff); } -- 2.17.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
