[ovs-git] [openvswitch/ovs] 044c84: odp-util: Fix clearing match mask if set action is...
noreply at github.com
Wed Jul 29 22:10:00 UTC 2020
Author: Ilya Maximets <i.maximets at ovn.org>
Date: 2020-07-29 (Wed, 29 Jul 2020)
odp-util: Fix clearing match mask if set action is partially unnecessary.
While committing set() actions, commit() could wildcard all the fields
that are same in match key and in the set action. This leads to
situation where mask after commit could actually contain less bits
than it was before. And if set action was partially committed, all
the fields that were the same will be cleared out from the matching key
resulting in the incorrect (too wide) flow.
For example, for the flow that matches on both src and dst mac
addresses, if the dst mac is the same and only src should be changed
by the set() action, destination address will be wildcarded in the
match key and will never be matched, i.e. flows with any destination
mac will match, which is not correct.
Setting OF rule:
Sending following packets on port 1:
Resulted datapath flows:
The first flow doesn't have any match on source MAC address and the
third packet successfully matched on it while it must be dropped.
Fix that by updating the match mask with only the new bits set by
commit(), but keeping those that were cleared (OR operation).
With fix applied, resulted correct flows are:
The code before commit dbf4a92800d0 was not able to reduce the mask,
it was only possible to expand it to exact match, so it was OK to
update original matching mask with the new value in all cases.
Fixes: dbf4a92800d0 ("odp-util: Do not rewrite fields with the same values as matched")
Acked-by: Eli Britstein <elibr at mellanox.com>
Tested-by: Adrián Moreno <amorenoz at redhat.com>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
More information about the git