lacp: Enforce valid lacp-system-id configuration.
authorEthan Jackson <ethan@nicira.com>
Thu, 15 Dec 2011 00:34:52 +0000 (16:34 -0800)
committerEthan Jackson <ethan@nicira.com>
Tue, 17 Jan 2012 02:14:56 +0000 (18:14 -0800)
With this patch, when a user attempts to configure LACP with an
invalid system ID, OVS will fail to create the bond and warn.
This behavior seems safer then defaulting to the bridge Ethernet
address which may surprise users.

Bug #8710.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
vswitchd/bridge.c
vswitchd/vswitch.xml

index b45b972..799124b 100644 (file)
@@ -2664,9 +2664,14 @@ port_configure_lacp(struct port *port, struct lacp_settings *s)
     s->name = port->name;
 
     system_id = get_port_other_config(port->cfg, "lacp-system-id", NULL);
-    if (!system_id
-        || sscanf(system_id, ETH_ADDR_SCAN_FMT,
-                  ETH_ADDR_SCAN_ARGS(s->id)) != ETH_ADDR_SCAN_COUNT) {
+    if (system_id) {
+        if (sscanf(system_id, ETH_ADDR_SCAN_FMT,
+                   ETH_ADDR_SCAN_ARGS(s->id)) != ETH_ADDR_SCAN_COUNT) {
+            VLOG_WARN("port %s: LACP system ID (%s) must be an Ethernet"
+                      " address.", port->name, system_id);
+            return NULL;
+        }
+    } else {
         memcpy(s->id, port->bridge->ea, ETH_ADDR_LEN);
     }
 
index e28b053..585f678 100644 (file)
         <column name="other_config" key="lacp-system-id">
           The LACP system ID of this <ref table="Port"/>.  The system ID of a
           LACP bond is used to identify itself to its partners.  Must be a
-          nonzero MAC address.
+          nonzero MAC address. Defaults to the bridge Ethernet address if
+          unset.
         </column>
 
         <column name="other_config" key="lacp-system-priority"