switch's tables are removed. See \fBFlow Syntax\fR, below, for the
syntax of \fIflows\fR.
.
-.TP
-\fBmonitor \fIswitch\fR [\fImiss-len\fR]
+.IP "\fBsnoop \fIswitch\fR"
+Connects to \fIswitch\fR and prints to the console all OpenFlow
+messages received. Unlike other \fBovs\-ofctl\fR commands, if
+\fIswitch\fR is the name of a bridge, then the \fBsnoop\fR command
+connects to a Unix domain socket named
+\fB@RUNDIR@/\fIbridge\fB.snoop\fR. \fBovs\-vswitchd\fR listens on
+such a socket for each bridge and sends to it all of the OpenFlow
+messages sent to or received from its configured OpenFlow controller.
+Thus, this command can be used to view OpenFlow protocol activity
+between a switch and its controller.
+.IP
+When a switch has more than one controller configured, only the
+protocol to and from a single controller, chosen arbitrarily by Open
+vSwitch, is given. If a switch has no controller configured, or if
+the configured controller is disconnected, no traffic is sent, so
+monitoring will not show any traffic.
+.
+.IQ "\fBmonitor \fIswitch\fR [\fImiss-len\fR]"
Connects to \fIswitch\fR and prints to the console all OpenFlow
messages received. Usually, \fIswitch\fR should specify a connection
named on \fBovs\-openflowd\fR(8)'s \fB-l\fR or \fB--listen\fR command line
.IP
If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
configuration'' message at connection setup time that requests
-\fImiss-len\fR bytes of each packet that misses the flow table. The
-OpenFlow reference implementation does not send these messages to the
+\fImiss-len\fR bytes of each packet that misses the flow table. Open vSwitch
+does not send these and other asynchronous messages to an
\fBovs\-ofctl monitor\fR client connection unless a nonzero value is
-specified on this argument.
+specified on this argument. (Thus, if \fImiss\-len\fR is not
+specified, very little traffic will ordinarily be printed.)
.IP
This command may be useful for debugging switch or controller
implementations.
}
static void
-open_vconn(const char *name, struct vconn **vconnp)
+open_vconn__(const char *name, const char *default_suffix,
+ struct vconn **vconnp)
{
struct dpif *dpif;
struct stat s;
char *bridge_path, *datapath_name, *datapath_type;
- bridge_path = xasprintf("%s/%s.mgmt", ovs_rundir, name);
+ bridge_path = xasprintf("%s/%s.%s", ovs_rundir, name, default_suffix);
dp_parse_name(name, &datapath_name, &datapath_type);
if (strstr(name, ":")) {
VLOG_INFO("datapath %s is named %s", name, dpif_name);
}
- socket_name = xasprintf("%s/%s.mgmt", ovs_rundir, dpif_name);
+ socket_name = xasprintf("%s/%s.%s",
+ ovs_rundir, dpif_name, default_suffix);
if (stat(socket_name, &s)) {
ovs_fatal(errno, "cannot connect to %s: stat failed on %s",
name, socket_name);
free(bridge_path);
}
+static void
+open_vconn(const char *name, struct vconn **vconnp)
+{
+ return open_vconn__(name, "mgmt", vconnp);
+}
+
static void *
alloc_stats_request(size_t body_len, uint16_t type, struct ofpbuf **bufferp)
{
}
static void
-do_monitor(int argc OVS_UNUSED, char *argv[])
+monitor_vconn(struct vconn *vconn)
+{
+ for (;;) {
+ struct ofpbuf *b;
+ run(vconn_recv_block(vconn, &b), "vconn_recv");
+ ofp_print(stderr, b->data, b->size, 2);
+ ofpbuf_delete(b);
+ }
+}
+
+static void
+do_monitor(int argc, char *argv[])
{
struct vconn *vconn;
osc->miss_send_len = htons(miss_send_len);
send_openflow_buffer(vconn, buf);
}
- for (;;) {
- struct ofpbuf *b;
- run(vconn_recv_block(vconn, &b), "vconn_recv");
- ofp_print(stderr, b->data, b->size, 2);
- ofpbuf_delete(b);
- }
+ monitor_vconn(vconn);
+}
+
+static void
+do_snoop(int argc OVS_UNUSED, char *argv[])
+{
+ struct vconn *vconn;
+
+ open_vconn__(argv[1], "snoop", &vconn);
+ monitor_vconn(vconn);
}
static void
{ "show", 1, 1, do_show },
{ "status", 1, 2, do_status },
{ "monitor", 1, 2, do_monitor },
+ { "snoop", 1, 1, do_snoop },
{ "dump-desc", 1, 1, do_dump_desc },
{ "dump-tables", 1, 1, do_dump_tables },
{ "dump-flows", 1, 2, do_dump_flows },