}
static inline bool eth_addr_is_local(const uint8_t ea[6])
{
- return ea[0] & 2;
+ /* Local if it is either a locally administered address or a Nicira random
+ * address. */
+ return !!(ea[0] & 2)
+ || (ea[0] == 0x00 && ea[1] == 0x23 && ea[2] == 0x20 && !!(ea[3] & 0x80));
}
static inline bool eth_addr_is_zero(const uint8_t ea[6])
{
random_bytes(ea, ETH_ADDR_LEN);
eth_addr_mark_random(ea);
}
+static inline void eth_addr_nicira_random(uint8_t ea[ETH_ADDR_LEN])
+{
+ eth_addr_random(ea);
+
+ /* Set the OUI to the Nicira one. */
+ ea[0] = 0x00;
+ ea[1] = 0x23;
+ ea[2] = 0x20;
+
+ /* Set the top bit to indicate random Nicira address. */
+ ea[3] |= 0x80;
+}
/* Returns true if 'ea' is a reserved multicast address, that a bridge must
* never forward, false otherwise. */
static inline bool eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])
/* Compose ofp_packet_in. */
ofpbuf_init(&b, 128);
- eth_addr_random(mac);
+ eth_addr_nicira_random(mac);
compose_benign_packet(&b, "Open vSwitch Controller Probe", 0xa033, mac);
opi = make_packet_in(pktbuf_get_null(), OFPP_LOCAL, OFPR_NO_MATCH, &b, 64);
ofpbuf_uninit(&b);
pick_fallback_dpid(void)
{
uint8_t ea[ETH_ADDR_LEN];
- eth_addr_random(ea);
- ea[0] = 0x00; /* Set Nicira OUI. */
- ea[1] = 0x23;
- ea[2] = 0x20;
+ eth_addr_nicira_random(ea);
return eth_addr_to_uint64(ea);
}
\f
br->cfg = br_cfg;
br->ml = mac_learning_create();
br->sent_config_request = false;
- eth_addr_random(br->default_ea);
+ eth_addr_nicira_random(br->default_ea);
port_array_init(&br->ifaces);