Skip to content

Commit a805558

Browse files
committed
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>
1 parent 09b0fa9 commit a805558

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/ofp-parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
477477

478478
err = ofpacts_check(ofpacts.data, ofpacts.size, &fm->match.flow,
479479
OFPP_MAX, fm->table_id, 255, usable_protocols);
480-
if (!err && !usable_protocols) {
480+
if (!err && !*usable_protocols) {
481481
err = OFPERR_OFPBAC_MATCH_INCONSISTENT;
482482
}
483483
if (err) {

tests/ovs-ofctl.at

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ do
127127
echo "### test case: '$1' should have usable protocols '$2'"
128128
if test "$2" = none; then
129129
AT_CHECK([ovs-ofctl parse-flow "$1,actions=drop"], [1],
130-
[usable protocols: none
130+
[dnl
131131
],
132-
[ovs-ofctl: no usable protocol
132+
[ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
133133
])
134134
else
135135
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
309309
]])
310310

311311
AT_CHECK([ovs-ofctl parse-flows flows.txt
312-
], [1], [usable protocols: none
312+
], [1], [dnl
313313
], [stderr])
314314

315315
AT_CLEANUP

0 commit comments

Comments
 (0)