[ovs-dev] [PATCH] bridge: Keep default Ethernet address stable between runs.

Ben Pfaff blp at nicira.com
Tue May 10 18:38:25 UTC 2011


In some circumstances the bridge can't find a stable physical Ethernet
address to use, so until now it has just picked a random Ethernet address.
In these circumstances, therefore, the bridge Ethernet address would change
from one ovs-vswitchd run to another.  But OVS does have a stable
identifier for a bridge: its UUID.  This commit changes to use that as the
default bridge Ethernet address.

The datapath ID is sometimes derived from the bridge Ethernet address, so
this change also makes the bridge Ethernet address more stable.

CC: Natasha Gude <natasha at nicira.com>
Bug #5594.
---
 vswitchd/bridge.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 55c9f40..9accbdd 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1696,7 +1696,11 @@ bridge_create(const struct ovsrec_bridge *br_cfg)
     br->name = xstrdup(br_cfg->name);
     br->cfg = br_cfg;
     br->ml = mac_learning_create();
-    eth_addr_nicira_random(br->default_ea);
+
+    /* Derive the default Ethernet address from the bridge's UUID.  This should
+     * be unique and it will be stable between ovs-vswitchd runs.  */
+    memcpy(br->default_ea, &br_cfg->header_.uuid, ETH_ADDR_LEN);
+    eth_addr_mark_random(br->default_ea);
 
     hmap_init(&br->ports);
     hmap_init(&br->ifaces);
-- 
1.7.4.4




More information about the dev mailing list