mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
ofp-parse: Fix typo in consistency check.
This check in parse_ofp_str__() attempted to detect inconsistencies between matches and actions, or inconsistencies within the actions. In this case, ofpacts_check() would effectively zero the "usable_protocols" and return 0 (ie, OK). However, when checking the return parameter, it checks the pointer rather than the value. In practice, this seems to only come up for fields which are used internally in OVS and not exposed for matching from the controller, like tunnel flags or skb_priority. Found by MIT STACK undefined behaviour checker. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -477,7 +477,7 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
|
||||
|
||||
err = ofpacts_check(ofpacts.data, ofpacts.size, &fm->match.flow,
|
||||
OFPP_MAX, fm->table_id, 255, usable_protocols);
|
||||
if (!err && !usable_protocols) {
|
||||
if (!err && !*usable_protocols) {
|
||||
err = OFPERR_OFPBAC_MATCH_INCONSISTENT;
|
||||
}
|
||||
if (err) {
|
||||
|
@@ -127,9 +127,9 @@ do
|
||||
echo "### test case: '$1' should have usable protocols '$2'"
|
||||
if test "$2" = none; then
|
||||
AT_CHECK([ovs-ofctl parse-flow "$1,actions=drop"], [1],
|
||||
[usable protocols: none
|
||||
[dnl
|
||||
],
|
||||
[ovs-ofctl: no usable protocol
|
||||
[ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
|
||||
])
|
||||
else
|
||||
AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$1,actions=drop" | sed 1q], [0],
|
||||
@@ -309,7 +309,7 @@ skb_priority=0x12341234,tcp,tp_src=123,actions=flood
|
||||
]])
|
||||
|
||||
AT_CHECK([ovs-ofctl parse-flows flows.txt
|
||||
], [1], [usable protocols: none
|
||||
], [1], [dnl
|
||||
], [stderr])
|
||||
|
||||
AT_CLEANUP
|
||||
|
Reference in New Issue
Block a user