projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add --max-idle option to secchan and controller.
[openvswitch]
/
secchan
/
secchan.c
diff --git
a/secchan/secchan.c
b/secchan/secchan.c
index 66993ba8e5c87a04f2d5778554d16b539263d9ba..08002143115cb2e6991093d91dc4bb957b11c896 100644
(file)
--- a/
secchan/secchan.c
+++ b/
secchan/secchan.c
@@
-107,6
+107,10
@@
static enum fail_mode fail_mode = FAIL_OPEN;
* fail_mode is FAIL_OPEN. */
static int fail_open_delay = 30;
* fail_mode is FAIL_OPEN. */
static int fail_open_delay = 30;
+/* --max-idle: Idle time to assign to flows created by learning switch when in
+ * fail-open mode. */
+static int max_idle = 15;
+
static void parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
static void parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
@@
-409,7
+413,8
@@
local_hook(struct relay *r)
/* Add new flow. */
if (out_port != OFPP_FLOOD) {
/* Add new flow. */
if (out_port != OFPP_FLOOD) {
- b = make_add_simple_flow(&flow, ntohl(opi->buffer_id), out_port);
+ b = make_add_simple_flow(&flow, ntohl(opi->buffer_id), out_port,
+ max_idle);
if (rconn_force_send(rc, b)) {
buffer_delete(b);
}
if (rconn_force_send(rc, b)) {
buffer_delete(b);
}
@@
-453,7
+458,7
@@
fail_open_hook(struct relay *r)
if (!r->lswitch) {
VLOG_WARN("Could not connect to controller for %d seconds, "
"failing open", disconnected_duration);
if (!r->lswitch) {
VLOG_WARN("Could not connect to controller for %d seconds, "
"failing open", disconnected_duration);
- r->lswitch = lswitch_create(local, true,
tru
e);
+ r->lswitch = lswitch_create(local, true,
max_idl
e);
}
/* Do switching. */
}
/* Do switching. */
@@
-465,9
+470,11
@@
fail_open_hook(struct relay *r)
static void
parse_options(int argc, char *argv[])
{
static void
parse_options(int argc, char *argv[])
{
+ enum { OPT_MAX_IDLE = UCHAR_MAX + 1 };
static struct option long_options[] = {
{"fail", required_argument, 0, 'f'},
{"fail-open-delay", required_argument, 0, 'd'},
static struct option long_options[] = {
{"fail", required_argument, 0, 'f'},
{"fail-open-delay", required_argument, 0, 'd'},
+ {"max-idle", required_argument, 0, OPT_MAX_IDLE},
{"listen", required_argument, 0, 'l'},
{"detach", no_argument, 0, 'D'},
{"pidfile", optional_argument, 0, 'P'},
{"listen", required_argument, 0, 'l'},
{"detach", no_argument, 0, 'D'},
{"pidfile", optional_argument, 0, 'P'},
@@
-507,6
+514,18
@@
parse_options(int argc, char *argv[])
}
break;
}
break;
+ case OPT_MAX_IDLE:
+ if (!strcmp(optarg, "permanent")) {
+ max_idle = OFP_FLOW_PERMANENT;
+ } else {
+ max_idle = atoi(optarg);
+ if (max_idle < 1 || max_idle > 65535) {
+ fatal(0, "--max-idle argument must be between 1 and "
+ "65535 or the word 'permanent'");
+ }
+ }
+ break;
+
case 'D':
set_detach();
break;
case 'D':
set_detach();
break;
@@
-560,6
+579,7
@@
usage(void)
" open (default): act as learning switch\n"
" -d, --fail-open-delay=SECS number of seconds after which to\n"
" fail open if --fail=open (default: 30)\n"
" open (default): act as learning switch\n"
" -d, --fail-open-delay=SECS number of seconds after which to\n"
" fail open if --fail=open (default: 30)\n"
+ " --max-idle=SECS max idle for flows set up by secchan\n"
" -l, --listen=METHOD allow management connections on METHOD\n"
" (a passive OpenFlow connection method)\n"
"\nOther options:\n"
" -l, --listen=METHOD allow management connections on METHOD\n"
" (a passive OpenFlow connection method)\n"
"\nOther options:\n"