aboutsummaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2012-01-13 17:54:04 -0800
committerPravin B Shelar <pshelar@nicira.com>2012-01-13 17:54:04 -0800
commitf0fd1a1772665ea57662281d9cccadb0f0146196 (patch)
tree121dd0e66a6e006f2a985ea5e708276301b5954f /utilities
parent444cacf4a7017a2b78418b7d12cd2f0a1e0dbb85 (diff)
ofproto: New action TTL decrement.
Following patch implements dec_ttl as vendor action with similar semantics as OpenFlow 1.2. If TTL reaches zero while procession actions in current table, the remaining actions in previous tables are processed. A configuration parameter is added to make TTL decrement to zero generate packet in. Feature #8758 Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-ofctl.8.in19
-rw-r--r--utilities/ovs-ofctl.c36
2 files changed, 53 insertions, 2 deletions
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 4bfd5436..2a20a2f4 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -243,7 +243,7 @@ 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.
.
-.IP "\fBmonitor \fIswitch\fR [\fImiss-len\fR]"
+.IP "\fBmonitor \fIswitch\fR [\fImiss-len\fR] [\fIinvalid_ttl\fR]"
Connects to \fIswitch\fR and prints to the console all OpenFlow
messages received. Usually, \fIswitch\fR should specify the name of a
bridge in the \fBovs\-vswitchd\fR database.
@@ -256,6 +256,13 @@ does not send these and other asynchronous messages to an
specified on this argument. (Thus, if \fImiss\-len\fR is not
specified, very little traffic will ordinarily be printed.)
.IP
+.IP
+If \fBinvalid_ttl\fR is passed, \fBovs\-ofctl\fR sends an OpenFlow ``set
+configuration'' message at connection setup time that requests
+\fIINVALID_TTL_TO_CONTROLLER\fR, so that \fBovs\-ofctl monitor\fR can
+receive ``packets-in'' messages when TTL reaches zero on \fBdec_ttl\fR action.
+.IP
+
This command may be useful for debugging switch or controller
implementations.
.
@@ -778,6 +785,16 @@ OpenFlow implementations do not support queuing at all.
Restores the queue to the value it was before any \fBset_queue\fR
actions were applied.
.
+.IP \fBdec_ttl\fR
+Decrement TTL of IPv4 packet or hop limit of IPv6 packet. If the
+TTL or hop limit is initially zero, no decrement occurs. Instead,
+a ``packet-in'' message with reason code \fBOFPR_INVALID_TTL\fR is
+sent to each connected controller that has enabled receiving them,
+if any. Processing the current set of actions then stops.
+However, if the current set of actions was reached through
+``resubmit'' then remaining actions in outer levels resume
+processing.
+.
.IP \fBnote:\fR[\fIhh\fR]...
Does nothing at all. Any number of bytes represented as hex digits
\fIhh\fR may be included. Pairs of hex digits may be separated by
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 6219f94a..8a8b8b2d 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -794,6 +794,35 @@ set_packet_in_format(struct vconn *vconn,
ofputil_packet_in_format_to_string(packet_in_format));
}
+static int
+monitor_set_invalid_ttl_to_controller(struct vconn *vconn)
+{
+ struct ofp_switch_config config;
+ enum ofp_config_flags flags;
+
+ fetch_switch_config(vconn, &config);
+ flags = ntohs(config.flags);
+ if (!(flags & OFPC_INVALID_TTL_TO_CONTROLLER)) {
+ /* Set the invalid ttl config. */
+ flags |= OFPC_INVALID_TTL_TO_CONTROLLER;
+
+ config.flags = htons(flags);
+ set_switch_config(vconn, &config);
+
+ /* Then retrieve the configuration to see if it really took. OpenFlow
+ * doesn't define error reporting for bad modes, so this is all we can
+ * do. */
+ fetch_switch_config(vconn, &config);
+ flags = ntohs(config.flags);
+ if (!(flags & OFPC_INVALID_TTL_TO_CONTROLLER)) {
+ ovs_fatal(0, "setting invalid_ttl_to_controller failed (this "
+ "switch probably doesn't support mode)");
+ return -EOPNOTSUPP;
+ }
+ }
+ return 0;
+}
+
static void
monitor_vconn(struct vconn *vconn)
{
@@ -876,6 +905,11 @@ do_monitor(int argc, char *argv[])
config.miss_send_len = htons(atoi(argv[2]));
set_switch_config(vconn, &config);
}
+ if (argc > 3) {
+ if (!strcmp(argv[3], "invalid_ttl")) {
+ monitor_set_invalid_ttl_to_controller(vconn);
+ }
+ }
monitor_vconn(vconn);
}
@@ -1634,7 +1668,7 @@ do_ofp_print(int argc, char *argv[])
static const struct command all_commands[] = {
{ "show", 1, 1, do_show },
- { "monitor", 1, 2, do_monitor },
+ { "monitor", 1, 3, do_monitor },
{ "snoop", 1, 1, do_snoop },
{ "dump-desc", 1, 1, do_dump_desc },
{ "dump-tables", 1, 1, do_dump_tables },