ovs-vsctl: Remove default timeout.
[sliver-openvswitch.git] / utilities / ovs-openflowd.c
index 6dda8fb..8cb50e4 100644 (file)
@@ -69,15 +69,11 @@ struct ofsettings {
     const char *dp_desc;        /* Datapath description. */
 
     /* Related vconns and network devices. */
-    struct svec listeners;       /* Listen for management connections. */
     struct svec snoops;          /* Listen for controller snooping conns. */
 
     /* Failure behavior. */
     int max_idle;             /* Idle time for flows in fail-open mode. */
 
-    /* Spanning tree protocol. */
-    bool enable_stp;
-
     /* NetFlow. */
     struct svec netflow;        /* NetFlow targets. */
 };
@@ -140,16 +136,6 @@ main(int argc, char *argv[])
     }
     ofproto_set_desc(ofproto, s.mfr_desc, s.hw_desc, s.sw_desc,
                      s.serial_desc, s.dp_desc);
-    if (!s.listeners.n) {
-        svec_add_nocopy(&s.listeners, xasprintf("punix:%s/%s.mgmt",
-                                              ovs_rundir, s.dp_name));
-    } else if (s.listeners.n == 1 && !strcmp(s.listeners.names[0], "none")) {
-        svec_clear(&s.listeners);
-    }
-    error = ofproto_set_listeners(ofproto, &s.listeners);
-    if (error) {
-        ovs_fatal(error, "failed to configure management connections");
-    }
     error = ofproto_set_snoops(ofproto, &s.snoops);
     if (error) {
         ovs_fatal(error,
@@ -161,10 +147,6 @@ main(int argc, char *argv[])
     if (error) {
         ovs_fatal(error, "failed to configure NetFlow collectors");
     }
-    error = ofproto_set_stp(ofproto, s.enable_stp);
-    if (error) {
-        ovs_fatal(error, "failed to configure STP");
-    }
     ofproto_set_controllers(ofproto, s.controllers, s.n_controllers);
     ofproto_set_fail_mode(ofproto, s.fail_mode);
 
@@ -214,8 +196,6 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
         OPT_RATE_LIMIT,
         OPT_BURST_LIMIT,
         OPT_BOOTSTRAP_CA_CERT,
-        OPT_STP,
-        OPT_NO_STP,
         OPT_OUT_OF_BAND,
         OPT_IN_BAND,
         OPT_NETFLOW,
@@ -242,8 +222,6 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
         {"snoop",      required_argument, 0, OPT_SNOOP},
         {"rate-limit",  optional_argument, 0, OPT_RATE_LIMIT},
         {"burst-limit", required_argument, 0, OPT_BURST_LIMIT},
-        {"stp",         no_argument, 0, OPT_STP},
-        {"no-stp",      no_argument, 0, OPT_NO_STP},
         {"out-of-band", no_argument, 0, OPT_OUT_OF_BAND},
         {"in-band",     no_argument, 0, OPT_IN_BAND},
         {"netflow",     required_argument, 0, OPT_NETFLOW},
@@ -262,6 +240,8 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
     };
     char *short_options = long_options_to_short_options(long_options);
     struct ofproto_controller controller_opts;
+    struct svec controllers;
+    int i;
 
     /* Set defaults that we can figure out before parsing options. */
     controller_opts.target = NULL;
@@ -279,10 +259,9 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
     s->sw_desc = NULL;
     s->serial_desc = NULL;
     s->dp_desc = NULL;
-    svec_init(&s->listeners);
+    svec_init(&controllers);
     svec_init(&s->snoops);
     s->max_idle = 0;
-    s->enable_stp = false;
     svec_init(&s->netflow);
     svec_init(&s->ports);
     for (;;) {
@@ -387,14 +366,6 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
             }
             break;
 
-        case OPT_STP:
-            s->enable_stp = true;
-            break;
-
-        case OPT_NO_STP:
-            s->enable_stp = false;
-            break;
-
         case OPT_OUT_OF_BAND:
             controller_opts.band = OFPROTO_OUT_OF_BAND;
             break;
@@ -408,7 +379,7 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
             break;
 
         case 'l':
-            svec_add(&s->listeners, optarg);
+            svec_add(&controllers, optarg);
             break;
 
         case OPT_SNOOP:
@@ -451,8 +422,8 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
 
     argc -= optind;
     argv += optind;
-    if (argc < 1 || argc > 2) {
-        ovs_fatal(0, "need one or two non-option arguments; "
+    if (argc < 1) {
+        ovs_fatal(0, "need at least one non-option arguments; "
                   "use --help for usage");
     }
 
@@ -471,19 +442,28 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
     /* Local vconns. */
     dp_parse_name(argv[0], &s->dp_name, &s->dp_type);
 
-    /* Controllers. */
-    s->n_controllers = argc > 1 ? argc - 1 : 1;
+    /* Figure out controller names. */
+    if (!controllers.n) {
+        svec_add_nocopy(&controllers,
+                        xasprintf("punix:%s/%s.mgmt", ovs_rundir, s->dp_name));
+    }
+    for (i = 1; i < argc; i++) {
+        svec_add(&controllers, argv[i]);
+    }
+    if (argc < 2) {
+        svec_add(&controllers, "discover");
+    }
+
+    /* Set up controllers. */
+    s->n_controllers = controllers.n;
     s->controllers = xmalloc(s->n_controllers * sizeof *s->controllers);
     if (argc > 1) {
         size_t i;
 
         for (i = 0; i < s->n_controllers; i++) {
             s->controllers[i] = controller_opts;
-            s->controllers[i].target = argv[i + 1];
+            s->controllers[i].target = controllers.names[i];
         }
-    } else {
-        s->controllers[0] = controller_opts;
-        s->controllers[0].target = "discover";
     }
 
     /* Sanity check. */