2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-17 14:28:02 +00:00

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.
This commit is contained in:
Ben Pfaff
2011-05-10 11:38:24 -07:00
parent 2db65bf72c
commit e3f55cb8b2

View File

@@ -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);