summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2017-05-15 10:04:58 -0700
committerBen Pfaff <blp@ovn.org>2017-05-31 14:54:10 -0700
commit880b145831ad1f2b0af2d08c4ad435ca0b6c98ad (patch)
tree5a04e1af3340ed69e4b109ccad5aef2a081a67bc /lib
parentd7892c814a8a9cf5681d34c6470bc9d841f4ad21 (diff)
downloadopenvswitch-880b145831ad1f2b0af2d08c4ad435ca0b6c98ad.tar.gz
ofp-parse: Parse pipeline fields in OF1.5 packet-out
This patch adds support for parsing the pipeline match fields of OpenFlow 1.5 packet-out messages. With this patch, we can use ovs-ofctl to specify pipeline fileds for a packet-out message. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ofp-parse.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 7b0d23feb..afb8b40cc 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -622,6 +622,7 @@ parse_ofp_packet_out_str__(struct ofputil_packet_out *po, char *string,
*po = (struct ofputil_packet_out) {
.buffer_id = UINT32_MAX,
};
+ match_init_catchall(&po->flow_metadata);
match_set_in_port(&po->flow_metadata, OFPP_CONTROLLER);
act_str = extract_actions(string);
@@ -655,8 +656,22 @@ parse_ofp_packet_out_str__(struct ofputil_packet_out *po, char *string,
goto out;
}
} else {
- error = xasprintf("unknown keyword %s", name);
- goto out;
+ const struct mf_field *mf = mf_from_name(name);
+ if (!mf) {
+ error = xasprintf("unknown keyword %s", name);
+ goto out;
+ }
+
+ error = parse_field(mf, value, &po->flow_metadata,
+ usable_protocols);
+ if (error) {
+ goto out;
+ }
+ if (!mf_is_pipeline_field(mf)) {
+ error = xasprintf("%s is not a valid pipeline field "
+ "for PACKET_OUT", name);
+ goto out;
+ }
}
}