Looks good to me, thx
On Mon, Sep 23, 2013 at 10:49 AM, Ben Pfaff <b...@nicira.com> wrote: > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > utilities/ovs-ofctl.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c > index c2cc1f6..1cd23e6 100644 > --- a/utilities/ovs-ofctl.c > +++ b/utilities/ovs-ofctl.c > @@ -50,6 +50,7 @@ > #include "openflow/nicira-ext.h" > #include "openflow/openflow.h" > #include "packets.h" > +#include "pcap-file.h" > #include "poll-loop.h" > #include "random.h" > #include "stream-ssl.h" > @@ -3076,6 +3077,36 @@ ofctl_parse_ofp11_instructions(int argc OVS_UNUSED, > char *argv[] OVS_UNUSED) > ds_destroy(&in); > } > > +/* "parse-pcap PCAP": read packets from PCAP and print their flows. */ > +static void > +ofctl_parse_pcap(int argc OVS_UNUSED, char *argv[]) > +{ > + FILE *pcap; > + > + pcap = pcap_open(argv[1], "rb"); > + if (!pcap) { > + ovs_fatal(errno, "%s: open failed", argv[1]); > + } > + > + for (;;) { > + struct ofpbuf *packet; > + struct flow flow; > + int error; > + > + error = pcap_read(pcap, &packet); > + if (error == EOF) { > + break; > + } else if (error) { > + ovs_fatal(error, "%s: read failed", argv[1]); > + } > + > + flow_extract(packet, 0, 0, NULL, NULL, &flow); > + flow_print(stdout, &flow); > + putchar('\n'); > + ofpbuf_delete(packet); > + } > +} > + > /* "check-vlan VLAN_TCI VLAN_TCI_MASK": converts the specified vlan_tci > and > * mask values to and from various formats and prints the results. */ > static void > @@ -3329,6 +3360,7 @@ static const struct command all_commands[] = { > { "parse-ofp11-match", 0, 0, ofctl_parse_ofp11_match }, > { "parse-ofp11-actions", 0, 0, ofctl_parse_ofp11_actions }, > { "parse-ofp11-instructions", 0, 0, ofctl_parse_ofp11_instructions }, > + { "parse-pcap", 1, 1, ofctl_parse_pcap }, > { "check-vlan", 2, 2, ofctl_check_vlan }, > { "print-error", 1, 1, ofctl_print_error }, > { "encode-error-reply", 2, 2, ofctl_encode_error_reply }, > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev