[ovs-dev] [lacp_bugs 4/7] lacp: Require non-zero system ID.

Ethan Jackson ethan at nicira.com
Wed Nov 30 03:53:21 UTC 2011


It's a bug if LACP is configured with a system ID of zero.  This
patch assert fails in this case.
---
 lib/lacp.c        |    1 +
 vswitchd/bridge.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/lacp.c b/lib/lacp.c
index 22cba94..9e63bbb 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -232,6 +232,7 @@ lacp_configure(struct lacp *lacp, const struct lacp_settings *s)
     if (!eth_addr_equals(lacp->sys_id, s->id)
         || lacp->sys_priority != s->priority
         || lacp->heartbeat != s->heartbeat) {
+        assert(!eth_addr_is_zero(s->id));
         memcpy(lacp->sys_id, s->id, ETH_ADDR_LEN);
         lacp->sys_priority = s->priority;
         lacp->heartbeat = s->heartbeat;
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d140565..b490176 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2658,6 +2658,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"));
-- 
1.7.7




More information about the dev mailing list