From a9bf011b82b02249344740d139f2f28594fe9e61 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 14 Dec 2011 16:34:52 -0800 Subject: [PATCH] lacp: Enforce valid lacp-system-id configuration. 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 --- vswitchd/bridge.c | 11 ++++++++--- vswitchd/vswitch.xml | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index b45b9727..799124bc 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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); } diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index e28b053b..585f6787 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -868,7 +868,8 @@ The LACP system ID of this . 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.