aboutsummaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-05-10 11:38:24 -0700
committerBen Pfaff <blp@nicira.com>2011-05-12 13:26:57 -0700
commite3f55cb8b25d03d8cb81f12a976c2ff1154e2826 (patch)
tree693ba7cd20658eafbf7a6104770e1af7eea299d5 /vswitchd
parent2db65bf72c008cf7ee658d0b44744b39495ead14 (diff)
bridge: Keep default Ethernet address stable between runs.
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@nicira.com> Bug #5594.
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 55c9f40a..9accbddd 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);