summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-trace.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jarno@ovn.org>2017-03-08 17:18:22 -0800
committerJarno Rajahalme <jarno@ovn.org>2017-03-08 17:22:27 -0800
commit67210a5510703df8311ce5e836c3c7ac92505cae (patch)
tree93bf36f989b979a85ba47a7d3b9db931898df9d1 /ofproto/ofproto-dpif-trace.c
parentfcbf7e1ed3ef7d3f144fbd3c1ae3064939e8dfb5 (diff)
downloadopenvswitch-67210a5510703df8311ce5e836c3c7ac92505cae.tar.gz
lib: Check match and action prerequisities with 'match'.
Supply the match mask to prerequisities checking when available. This allows checking for zero-valued matches. Non-zero valued matches imply the presense of corresponding mask bits, but for zero valued matches we must explicitly check the mask, too. This is required now only for conntrack validity checking due to the conntrack state having and 'invalid' bit, but not 'valid' bit. One way to match an valid conntrack state is to match on the 'tracked' bit being one and 'invalid' bit being zero. The latter requires the corresponding mask bit be verified. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-trace.c')
-rw-r--r--ofproto/ofproto-dpif-trace.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ofproto/ofproto-dpif-trace.c b/ofproto/ofproto-dpif-trace.c
index 3c9e3d414..d1cb1ddbb 100644
--- a/ofproto/ofproto-dpif-trace.c
+++ b/ofproto/ofproto-dpif-trace.c
@@ -324,7 +324,7 @@ ofproto_unixctl_trace_actions(struct unixctl_conn *conn, int argc,
struct ofpbuf ofpacts;
struct dp_packet *packet;
struct ds result;
- struct flow flow;
+ struct match match;
uint16_t in_port;
/* Three kinds of error return values! */
@@ -354,12 +354,13 @@ ofproto_unixctl_trace_actions(struct unixctl_conn *conn, int argc,
enforce_consistency = false;
}
- error = parse_flow_and_packet(argc, argv, &ofproto, &flow, &packet);
+ error = parse_flow_and_packet(argc, argv, &ofproto, &match.flow, &packet);
if (error) {
unixctl_command_reply_error(conn, error);
free(error);
goto exit;
}
+ match_wc_init(&match, &match.flow);
/* Do the same checks as handle_packet_out() in ofproto.c.
*
@@ -371,18 +372,18 @@ ofproto_unixctl_trace_actions(struct unixctl_conn *conn, int argc,
*
* We skip the "meter" check here because meter is an instruction, not an
* action, and thus cannot appear in ofpacts. */
- in_port = ofp_to_u16(flow.in_port.ofp_port);
+ in_port = ofp_to_u16(match.flow.in_port.ofp_port);
if (in_port >= ofproto->up.max_ports && in_port < ofp_to_u16(OFPP_MAX)) {
unixctl_command_reply_error(conn, "invalid in_port");
goto exit;
}
if (enforce_consistency) {
- retval = ofpacts_check_consistency(ofpacts.data, ofpacts.size, &flow,
+ retval = ofpacts_check_consistency(ofpacts.data, ofpacts.size, &match,
u16_to_ofp(ofproto->up.max_ports),
0, ofproto->up.n_tables,
usable_protocols);
} else {
- retval = ofpacts_check(ofpacts.data, ofpacts.size, &flow,
+ retval = ofpacts_check(ofpacts.data, ofpacts.size, &match,
u16_to_ofp(ofproto->up.max_ports), 0,
ofproto->up.n_tables, &usable_protocols);
}
@@ -400,7 +401,7 @@ ofproto_unixctl_trace_actions(struct unixctl_conn *conn, int argc,
goto exit;
}
- ofproto_trace(ofproto, &flow, packet,
+ ofproto_trace(ofproto, &match.flow, packet,
ofpacts.data, ofpacts.size, &result);
unixctl_command_reply(conn, ds_cstr(&result));