From bd6b231a81787749a85f78e66152c4a74556f0db Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 19 Mar 2009 12:39:00 -0700 Subject: [PATCH] vswitch: Don't choose Xen's FE:FF:FF:FF:FF:FF address as bridge MAC or DPID. Xen uses FE:FF:FF:FF:FF:FF as the mac address for every virtual interface. If we have a bridge that has just virtual interfaces, then this will end up as the bridge's MAC address and thus the datapath ID also. So, instead, use the bridge's randomly chosen MAC address if this case comes up. This is probably not the end of this issue, since we probably want the DPID of such bridges to be predictable. Need to figure out how to do that. --- lib/packets.h | 10 +++++++++- vswitchd/bridge.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/packets.h b/lib/packets.h index 7f6bd42f..0a0da381 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford +/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford * Junior University * * We are making the OpenFlow specification and associated documentation @@ -44,10 +44,18 @@ static const uint8_t eth_addr_broadcast[ETH_ADDR_LEN] UNUSED = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +/* This is the Ethernet address used by virtual interfaces under Xen. */ +static const uint8_t eth_addr_vif[ETH_ADDR_LEN] UNUSED + = { 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff }; + static inline bool eth_addr_is_broadcast(const uint8_t ea[6]) { return (ea[0] & ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) == 0xff; } +static inline bool eth_addr_is_vif(const uint8_t ea[6]) +{ + return ea[0] == 0xfe && (ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) == 0xff; +} static inline bool eth_addr_is_multicast(const uint8_t ea[6]) { return ea[0] & 1; diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index d7265cfd..ad62181a 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -552,7 +552,7 @@ bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN]) } } } - if (eth_addr_is_multicast(ea)) { + if (eth_addr_is_multicast(ea) || eth_addr_is_vif(ea)) { memcpy(ea, br->default_ea, ETH_ADDR_LEN); VLOG_WARN("bridge %s: using default bridge Ethernet " "address "ETH_ADDR_FMT, br->name, ETH_ADDR_ARGS(ea)); -- 2.30.2