From: Ben Pfaff Date: Wed, 8 Jun 2011 20:35:00 +0000 (-0700) Subject: ofp-parse: Ignore extra fields produced by dump-flows. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c6d841118a6b14cc5b03fc3b549143a6b7ce143;p=openvswitch ofp-parse: Ignore extra fields produced by dump-flows. It's reasonable to want to dump a flow table with "dump-flows" and then later use that output as input to other commands that read flows, but until now that hasn't been directly possible because "dump-flows" adds extra fields that other commands reject on input. This changes the flow parser to just ignore those extra fields. --- diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index efcfab07..a4679a3a 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -878,6 +878,12 @@ parse_ofp_str(struct flow_mod *fm, struct ofpbuf *actions, char *string) ovs_fatal(0, "only %d registers supported", FLOW_N_REGS); } parse_reg_value(&fm->cr, reg_idx, value); + } else if (!strcmp(name, "duration") + || !strcmp(name, "n_packets") + || !strcmp(name, "n_bytes")) { + /* Ignore these, so that users can feed the output of + * "ovs-ofctl dump-flows" back into commands that parse + * flows. */ } else { ovs_fatal(0, "unknown keyword %s", name); } diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 4a914ca4..c4fbed90 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -548,6 +548,11 @@ Same as \fBdl_type=0x86dd,nw_proto=17\fR. Same as \fBdl_type=0x86dd,nw_proto=58\fR. . .PP +Finally, field assignments to \fBduration\fR, \fBn_packets\fR, or +\fBn_bytes\fR are ignored to allow output from the \fBdump\-flows\fR +command to be used as input for other commands that parse flows. +. +.PP The \fBadd\-flow\fR and \fBadd\-flows\fR commands require an additional field, which must be the final field specified: .