Add the ability to disable the STP implementation.
authorBen Pfaff <blp@nicira.com>
Fri, 19 Sep 2008 22:37:53 +0000 (15:37 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 19 Sep 2008 22:37:53 +0000 (15:37 -0700)
secchan/secchan.8.in
secchan/secchan.c

index 4fd2f24e1972de7bb8ae3ee842427ccd8c4135d8..c7e8751a75f4d6d0f5798b6062d45735c94600f8 100644 (file)
@@ -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.
 
 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
 .TP
 \fB-p\fR, \fB--private-key=\fIprivkey.pem\fR
 Specifies a PEM file containing the private key used as the switch's
index 9233f0d1e67aa95bef8582c1323365ecbb4d17d6..341e146c2890d4a92a98fbc04ba2aa3fa5251e36 100644 (file)
@@ -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? */
     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 {
 };
 
 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);
 
     /* 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);
     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->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,
     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_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},
     };
     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},
         {"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'},
         {"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->update_resolv_conf = true;
     s->rate_limit = 0;
     s->burst_limit = 0;
+    s->enable_stp = true;
     for (;;) {
         int c;
 
     for (;;) {
         int c;
 
@@ -2155,6 +2165,10 @@ parse_options(int argc, char *argv[], struct settings *s)
             }
             break;
 
             }
             break;
 
+        case OPT_NO_STP:
+            s->enable_stp = false;
+            break;
+
         case 'D':
             set_detach();
             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"
            "                          (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"
            "\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"