From: Ben Pfaff Date: Tue, 10 May 2011 18:38:24 +0000 (-0700) Subject: bridge: Keep default Ethernet address stable between runs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3f55cb8b25d03d8cb81f12a976c2ff1154e2826;p=openvswitch 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 Bug #5594. --- 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);