mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
Do not perform validation in learn_parse();
I believe this is consistent with the handling of all other action parsing called from parse_named_action(). Verification of all actions, including learn actions, occurs separately in ofpact_check__(). It also occurs via in a call to ofpacts_check() in parse_ofp_str(), This patch is larger than might otherwise be expected as the flow argument of learn_parse() is now unused and thus removed. This propagates up the call-chain some way. This implementation was suggested by Jesse Gross in response to an enhancement I made to the validation performed during parsing learn actions to allow it to correctly account for changes to the dl_type due to MPLS push and pop actions. Tests have also been updated to check for the less specific messages generated by the call to ofpacts_check() in parse_ofp_str() which at the suggestion of Ben Pfaff was added by a prior patch for this purpose. Cc: Jesse Gross <jesse@nicira.com> Cc: Ben Pfaff <blp@nicira.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
25
lib/learn.c
25
lib/learn.c
@@ -512,14 +512,13 @@ learn_parse_spec(const char *orig, char *name, char *value,
|
||||
*
|
||||
* Modifies 'arg'. */
|
||||
void
|
||||
learn_parse(char *arg, const struct flow *flow, struct ofpbuf *ofpacts)
|
||||
learn_parse(char *arg, struct ofpbuf *ofpacts)
|
||||
{
|
||||
char *orig = xstrdup(arg);
|
||||
char *name, *value;
|
||||
|
||||
struct ofpact_learn *learn;
|
||||
struct match match;
|
||||
enum ofperr error;
|
||||
|
||||
learn = ofpact_put_LEARN(ofpacts);
|
||||
learn->idle_timeout = OFP_FLOW_PERMANENT;
|
||||
@@ -556,21 +555,6 @@ learn_parse(char *arg, const struct flow *flow, struct ofpbuf *ofpacts)
|
||||
|
||||
learn_parse_spec(orig, name, value, spec);
|
||||
|
||||
/* Check prerequisites. */
|
||||
if (spec->src_type == NX_LEARN_SRC_FIELD
|
||||
&& flow && !mf_are_prereqs_ok(spec->src.field, flow)) {
|
||||
ovs_fatal(0, "%s: cannot specify source field %s because "
|
||||
"prerequisites are not satisfied",
|
||||
orig, spec->src.field->name);
|
||||
}
|
||||
if ((spec->dst_type == NX_LEARN_DST_MATCH
|
||||
|| spec->dst_type == NX_LEARN_DST_LOAD)
|
||||
&& !mf_are_prereqs_ok(spec->dst.field, &match.flow)) {
|
||||
ovs_fatal(0, "%s: cannot specify destination field %s because "
|
||||
"prerequisites are not satisfied",
|
||||
orig, spec->dst.field->name);
|
||||
}
|
||||
|
||||
/* Update 'match' to allow for satisfying destination
|
||||
* prerequisites. */
|
||||
if (spec->src_type == NX_LEARN_SRC_IMMEDIATE
|
||||
@@ -581,13 +565,6 @@ learn_parse(char *arg, const struct flow *flow, struct ofpbuf *ofpacts)
|
||||
}
|
||||
ofpact_update_len(ofpacts, &learn->ofpact);
|
||||
|
||||
/* In theory the above should have caught any errors, but... */
|
||||
if (flow) {
|
||||
error = learn_check(learn, flow);
|
||||
if (error) {
|
||||
ovs_fatal(0, "%s: %s", orig, ofperr_to_string(error));
|
||||
}
|
||||
}
|
||||
free(orig);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user