From 55ecbead3945d0220f14da489e8cf35fa6d4d4bc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 19 Sep 2008 15:37:53 -0700 Subject: [PATCH] Add the ability to disable the STP implementation. --- secchan/secchan.8.in | 5 +++++ secchan/secchan.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/secchan/secchan.8.in b/secchan/secchan.8.in index 4fd2f24e..c7e8751a 100644 --- a/secchan/secchan.8.in +++ b/secchan/secchan.8.in @@ -325,6 +325,11 @@ Messages are copied to the monitoring connections on a best-effort basis. In particular, if the socket buffer of the monitoring connection fills up, some messages will be lost. +.TP +\fB--no-stp\fR +Disable implementation of IEEE 802.1D Spanning Tree Protocol at the +switch. + .TP \fB-p\fR, \fB--private-key=\fIprivkey.pem\fR Specifies a PEM file containing the private key used as the switch's diff --git a/secchan/secchan.c b/secchan/secchan.c index 9233f0d1..341e146c 100644 --- a/secchan/secchan.c +++ b/secchan/secchan.c @@ -110,6 +110,9 @@ struct settings { regex_t accept_controller_regex; /* Controller vconns to accept. */ const char *accept_controller_re; /* String version of regex. */ bool update_resolv_conf; /* Update /etc/resolv.conf? */ + + /* Spanning tree protocol. */ + bool enable_stp; }; struct half { @@ -288,7 +291,9 @@ main(int argc, char *argv[]) /* Set up hooks. */ hooks[n_hooks++] = port_watcher_create(local_rconn, remote_rconn, &pw); - hooks[n_hooks++] = stp_hook_create(&s, pw, local_rconn, remote_rconn); + if (s.enable_stp) { + hooks[n_hooks++] = stp_hook_create(&s, pw, local_rconn, remote_rconn); + } if (s.in_band) { hooks[n_hooks++] = in_band_hook_create(&s, switch_status, remote_rconn); @@ -1491,7 +1496,9 @@ fail_open_hook_create(const struct settings *s, struct switch_status *ss, fail_open->remote_rconn = remote_rconn; fail_open->lswitch = NULL; fail_open->boot_deadline = time_now() + s->probe_interval * 3; - fail_open->boot_deadline += STP_EXTRA_BOOT_TIME; + if (s->enable_stp) { + fail_open->boot_deadline += STP_EXTRA_BOOT_TIME; + } switch_status_register_category(ss, "fail-open", fail_open_status_cb, fail_open); return make_hook(fail_open_local_packet_cb, NULL, @@ -2042,7 +2049,8 @@ parse_options(int argc, char *argv[], struct settings *s) OPT_MAX_BACKOFF, OPT_RATE_LIMIT, OPT_BURST_LIMIT, - OPT_BOOTSTRAP_CA_CERT + OPT_BOOTSTRAP_CA_CERT, + OPT_NO_STP }; static struct option long_options[] = { {"accept-vconn", required_argument, 0, OPT_ACCEPT_VCONN}, @@ -2055,6 +2063,7 @@ parse_options(int argc, char *argv[], struct settings *s) {"monitor", required_argument, 0, 'm'}, {"rate-limit", optional_argument, 0, OPT_RATE_LIMIT}, {"burst-limit", required_argument, 0, OPT_BURST_LIMIT}, + {"no-stp", no_argument, 0, OPT_NO_STP}, {"detach", no_argument, 0, 'D'}, {"force", no_argument, 0, 'f'}, {"pidfile", optional_argument, 0, 'P'}, @@ -2081,6 +2090,7 @@ parse_options(int argc, char *argv[], struct settings *s) s->update_resolv_conf = true; s->rate_limit = 0; s->burst_limit = 0; + s->enable_stp = true; for (;;) { int c; @@ -2155,6 +2165,10 @@ parse_options(int argc, char *argv[], struct settings *s) } break; + case OPT_NO_STP: + s->enable_stp = false; + break; + case 'D': set_detach(); break; @@ -2309,6 +2323,7 @@ usage(void) " (a passive OpenFlow connection method)\n" " -m, --monitor=METHOD copy traffic to/from kernel to METHOD\n" " (a passive OpenFlow connection method)\n" + " --no-stp disable 802.1D Spanning Tree Protocol\n" "\nRate-limiting of \"packet-in\" messages to the controller:\n" " --rate-limit[=PACKETS] max rate, in packets/s (default: 1000)\n" " --burst-limit=BURST limit on packet credit for idle time\n" -- 2.30.2