lacp: Require non-zero system ID.
authorEthan Jackson <ethan@nicira.com>
Tue, 29 Nov 2011 21:22:18 +0000 (13:22 -0800)
committerEthan Jackson <ethan@nicira.com>
Wed, 30 Nov 2011 22:52:00 +0000 (14:52 -0800)
It's a bug if LACP is configured with a system ID of zero.  This
patch assert fails in this case.

lib/lacp.c
vswitchd/bridge.c

index 22cba9429bb9a13cc804be21a5bec870f65a9d1e..6ee55c3614fbe45f54af979ba52c9c9402ebd427 100644 (file)
@@ -224,6 +224,8 @@ lacp_destroy(struct lacp *lacp)
 void
 lacp_configure(struct lacp *lacp, const struct lacp_settings *s)
 {
+    assert(!eth_addr_is_zero(s->id));
+
     if (!lacp->name || strcmp(s->name, lacp->name)) {
         free(lacp->name);
         lacp->name = xstrdup(s->name);
index 85cc79e62b73bd66616cfca925df5fe2b63642b1..f79b69cdef0b70bf3705a1027d7ffff607f8ff5b 100644 (file)
@@ -2677,6 +2677,11 @@ port_configure_lacp(struct port *port, struct lacp_settings *s)
         memcpy(s->id, port->bridge->ea, ETH_ADDR_LEN);
     }
 
+    if (eth_addr_is_zero(s->id)) {
+        VLOG_WARN("port %s: Invalid zero LACP system ID.", port->name);
+        return NULL;
+    }
+
     /* Prefer bondable links if unspecified. */
     priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority",
                                           "0"));