summaryrefslogtreecommitdiff
path: root/utilities/ovs-controller.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-09-16 15:12:19 -0700
committerBen Pfaff <blp@nicira.com>2009-09-16 15:12:27 -0700
commit7778bd15dacc1e410b60ff6ec2996c475a875e6e (patch)
tree49eaedf3e0c1c5017e7eb1f4c2fed0312d5397ca /utilities/ovs-controller.c
parent372179d4f4a1dc6113bc4ea60cee76cb354e22f4 (diff)
downloadopenvswitch-7778bd15dacc1e410b60ff6ec2996c475a875e6e.tar.gz
secchan: Better tolerate failing controller admission control in fail-open.
When the switch is configured to connect to a controller that accepts connections, waits a few seconds, and then disconnects without setting up flows, currently this causes "fail-open" to flush the flow table and stop setting up new flows during the connection duration. This is OK if it happens once, but it can easily happen every 8 seconds with typical backoff settings, and that isn't so great. This commit changes fail-open to only flush the flow table once the switch appears to have been admitted by the controller, which prevents these frequent network interruptions. Thanks to Jesse Gross for especially valuable feedback. QA notes: Behavior in fail-open and especially behavior with a controller that rejects the switch after it connects needs to be re-tested. The ovs-controller --mute switch added by this commit is one simple way to create such a controller. CC: Peter Balland <peter@nicira.com> Bug #1695. Bug #2055.
Diffstat (limited to 'utilities/ovs-controller.c')
-rw-r--r--utilities/ovs-controller.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c
index 010cad794..314da1868 100644
--- a/utilities/ovs-controller.c
+++ b/utilities/ovs-controller.c
@@ -58,6 +58,10 @@ static bool setup_flows = true;
/* --max-idle: Maximum idle time, in seconds, before flows expire. */
static int max_idle = 60;
+/* --mute: If true, accept connections from switches but do not reply to any
+ * of their messages (for debugging fail-open mode). */
+static bool mute = false;
+
static int do_switching(struct switch_ *);
static void new_switch(struct switch_ *, struct vconn *, const char *name);
static void parse_options(int argc, char *argv[]);
@@ -211,7 +215,9 @@ do_switching(struct switch_ *sw)
msg = rconn_recv(sw->rconn);
if (msg) {
- lswitch_process_packet(sw->lswitch, sw->rconn, msg);
+ if (!mute) {
+ lswitch_process_packet(sw->lswitch, sw->rconn, msg);
+ }
ofpbuf_delete(msg);
}
rconn_run(sw->rconn);
@@ -227,12 +233,14 @@ parse_options(int argc, char *argv[])
enum {
OPT_MAX_IDLE = UCHAR_MAX + 1,
OPT_PEER_CA_CERT,
+ OPT_MUTE,
VLOG_OPTION_ENUMS
};
static struct option long_options[] = {
{"hub", no_argument, 0, 'H'},
{"noflow", no_argument, 0, 'n'},
{"max-idle", required_argument, 0, OPT_MAX_IDLE},
+ {"mute", no_argument, 0, OPT_MUTE},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
DAEMON_LONG_OPTIONS,
@@ -263,6 +271,10 @@ parse_options(int argc, char *argv[])
setup_flows = false;
break;
+ case OPT_MUTE:
+ mute = true;
+ break;
+
case OPT_MAX_IDLE:
if (!strcmp(optarg, "permanent")) {
max_idle = OFP_FLOW_PERMANENT;