diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-09-08 14:32:13 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-09-13 11:46:09 -0700 |
| commit | 8b3b8dd1a5a1a8ba3b7e62798ff70cb8f9fc7659 (patch) | |
| tree | 0b01b754ee17fc11f46fdfde02fbdeabf0840e18 /ofproto | |
| parent | 6a885fd0589fdfa3b5d05ca3ff4af52b085a1816 (diff) | |
| download | openvswitch-8b3b8dd1a5a1a8ba3b7e62798ff70cb8f9fc7659.tar.gz | |
ofproto-dpif: Add -generate option to ofproto/trace command.
Diffstat (limited to 'ofproto')
| -rw-r--r-- | ofproto/ofproto-dpif.c | 10 | ||||
| -rw-r--r-- | ofproto/ofproto-unixctl.man | 24 |
2 files changed, 25 insertions, 9 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index dfdaaa299..7174748b5 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4099,8 +4099,8 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, const char *args_, arg1 = strtok_r(NULL, " ", &save_ptr); arg2 = strtok_r(NULL, " ", &save_ptr); arg3 = strtok_r(NULL, "", &save_ptr); /* Get entire rest of line. */ - if (dpname && arg1 && !arg2 && !arg3) { - /* ofproto/trace dpname flow */ + if (dpname && arg1 && (!arg2 || !strcmp(arg2, "-generate")) && !arg3) { + /* ofproto/trace dpname flow [-generate] */ int error; /* Convert string to datapath key. */ @@ -4117,6 +4117,12 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, const char *args_, unixctl_command_reply(conn, 501, "Invalid flow"); goto exit; } + + /* Generate a packet, if requested. */ + if (arg2) { + packet = ofpbuf_new(0); + flow_compose(packet, &flow); + } } else if (dpname && arg1 && arg2 && arg3) { /* ofproto/trace dpname tun_id in_port packet */ uint16_t in_port; diff --git a/ofproto/ofproto-unixctl.man b/ofproto/ofproto-unixctl.man index 06db7e04d..2cf7bfaa8 100644 --- a/ofproto/ofproto-unixctl.man +++ b/ofproto/ofproto-unixctl.man @@ -7,12 +7,12 @@ Lists the names of the running ofproto instances. These are the names that may be used on \fBofproto/trace\fR. . .IP "\fBofproto/trace \fIswitch tun_id in_port packet\fR" -Traces the path of an imaginary packet through \fIswitch\fR. The -arguments are: +.IQ "\fBofproto/trace \fIswitch odp_flow \fB\-generate\fR" +Traces the path of an imaginary packet through \fIswitch\fR. Both +forms require \fIswitch\fR, the switch on which the packet arrived +(one of those listed by \fBofproto/list\fR). The first form specifies +a packet's contents explicitly: .RS -.IP "\fIswitch\fR" -The switch on which the packet arrived (one of those listed by -\fBofproto/list\fR). .IP "\fItun_id\fR" The tunnel ID on which the packet arrived. Use \fB0\fR if the packet did not arrive through a tunnel. @@ -27,9 +27,18 @@ by hand, so the \fBovs\-pcap\fR(1) and \fBovs\-tcpundump\fR(1) utilities provide easier ways. .RE .IP +The second form specifies the packet's contents implicitly: +.RS +.IP "\fIodp_flow\fR" +A flow in the form printed by \fBovs\-dpctl\fR(8)'s \fBdump\-flows\fR +command. This is not an OpenFlow flow: besides other differences, it +never contains wildcards. \fB\*(PN\fR generates an arbitrary packet +that has the specified \fIodp_flow\fR. +.RE +.IP \fB\*(PN\fR will respond with extensive information on how the packet would be handled if it were to be received. The packet will not -actually be sent. +actually be sent, but side effects such as MAC learning will occur. . .IP "\fBofproto/trace \fIswitch odp_flow\fR" Traces the path of a packet in an imaginary flow through @@ -46,7 +55,8 @@ never contains wildcards. .IP \fB\*(PN\fR will respond with extensive information on how a packet in \fIodp_flow\fR would be handled if it were received by -\fIswitch\fR. No packet will actually be sent. +\fIswitch\fR. No packet will actually be sent. Some side effects may +occur, but MAC learning in particular will not. .IP This form of \fBofproto/trace\fR cannot determine the complete set of datapath actions in some corner cases. If the results say that this |
