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 analyzer. Signed-off-by: Joe Stringer <joestrin...@nicira.com> --- lib/ofp-parse.c | 2 +- tests/ovs-ofctl.at | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 9e88d6d..8cdda50 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -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) { diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 28bca14..9d6c571 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -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 @@ tun_id=0x1234000056780000/0xffff0000ffff0000,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun ]]) AT_CHECK([ovs-ofctl parse-flows flows.txt -], [1], [usable protocols: none +], [1], [dnl ], [stderr]) AT_CLEANUP @@ -321,7 +321,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 -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev