From f9fb1858ef9f5c85863b320638b07af8043d1e5a Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Wed, 29 Jul 2009 11:31:07 -0700
Subject: [PATCH] Reduce default probe interval to 5 seconds (and fail-open
 timeout to 15).

Before now, the default probe interval (the idle time after which an echo
request is sent on an OpenFlow connection) was set to 15 seconds.  The
fail-open timeout is 3 times the probe interval, so this meant that it
took 45 seconds for a switch to fail open.

Users at Nicira have commented that this is too long.  They don't like the
idea that the network will be down for most of a minute before it begins to
recover.  So this commit changes the default probe interval to 5 seconds,
hence the fail-open timeout to 15 seconds.
---
 debian/openvswitch-switch.template | 2 +-
 secchan/ofproto.c                  | 2 +-
 secchan/secchan.8.in               | 2 +-
 vswitchd/bridge.c                  | 2 +-
 vswitchd/ovs-vswitchd.conf.5.in    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/debian/openvswitch-switch.template b/debian/openvswitch-switch.template
index c43def12b..69f1de607 100644
--- a/debian/openvswitch-switch.template
+++ b/debian/openvswitch-switch.template
@@ -135,7 +135,7 @@ MGMT_VCONNS="punix:/var/run/secchan.mgmt"
 # INACTIVITY_PROBE: The maximum number of seconds of inactivity on the
 # controller connection before secchan sends an inactivity probe
 # message to the controller.  The valid range is 5 and up.  If unset,
-# secchan defaults to 15 seconds.
+# secchan defaults to 5 seconds.
 #INACTIVITY_PROBE=5
 
 # MAX_BACKOFF: The maximum time that secchan will wait between
diff --git a/secchan/ofproto.c b/secchan/ofproto.c
index 7445ef6e9..19baab9ba 100644
--- a/secchan/ofproto.c
+++ b/secchan/ofproto.c
@@ -333,7 +333,7 @@ ofproto_create(const char *datapath, const struct ofhooks *ofhooks, void *aux,
 
     /* Initialize OpenFlow connections. */
     list_init(&p->all_conns);
-    p->controller = ofconn_create(p, rconn_create(15, 8));
+    p->controller = ofconn_create(p, rconn_create(5, 8));
     p->controller->pktbuf = pktbuf_create();
     p->controller->miss_send_len = OFP_DEFAULT_MISS_SEND_LEN;
     p->listeners = NULL;
diff --git a/secchan/secchan.8.in b/secchan/secchan.8.in
index af6e9e8fa..2ad50ae50 100644
--- a/secchan/secchan.8.in
+++ b/secchan/secchan.8.in
@@ -254,7 +254,7 @@ channel waits for a message to be received from the controller for
 controller.  After sending the inactivity probe, if no response is
 received for an additional \fIsecs\fR seconds, the secure channel
 assumes that the connection has been broken and attempts to reconnect.
-The default is 15 seconds, and the minimum value is 5 seconds.
+The default and the minimum value are both 5 seconds.
 
 When fail-open mode is configured, changing the inactivity probe
 interval also changes the interval before entering fail-open mode (see
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index e9c639027..b1073205d 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1204,7 +1204,7 @@ bridge_reconfigure_controller(struct bridge *br)
         if (probe < 5) {
             probe = cfg_get_int(0, "mgmt.inactivity-probe");
             if (probe < 5) {
-                probe = 15;
+                probe = 5;
             }
         }
         ofproto_set_probe_interval(br->ofproto, probe);
diff --git a/vswitchd/ovs-vswitchd.conf.5.in b/vswitchd/ovs-vswitchd.conf.5.in
index 57af2aa8b..d613419fc 100644
--- a/vswitchd/ovs-vswitchd.conf.5.in
+++ b/vswitchd/ovs-vswitchd.conf.5.in
@@ -384,7 +384,7 @@ key.  If \fBovs\-vswitchd\fR does not communicate with the controller for the
 specified number of seconds, it will send a probe.  If a response is not
 received for an additional amount of that time, \fBovs\-vswitchd\fR assumes
 the connection has been broken and attempts to reconnect.  The default
-is 15 seconds, and the minimum value is 5 seconds.
+and minimum values are both 5 seconds.
 
 A management id may be specified with the \fBmgmt.id\fR key.  It takes
 an id in the form of exactly 12 hexadecimal digits.  If one is not
-- 
2.47.0