mirror of
https://github.com/openvswitch/ovs
synced 2025-10-15 14:17:18 +00:00
vswitchd: Split pick_local_hw_addr
This allows to reuse find_local_hw_addr for fake bridges. Preparation for upcoming MAC address inheritance for fake bridges. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -1548,31 +1548,15 @@ bridge_configure_mac_table(struct bridge *br)
|
||||
}
|
||||
|
||||
static void
|
||||
bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
|
||||
struct iface **hw_addr_iface)
|
||||
find_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
|
||||
struct iface **hw_addr_iface)
|
||||
{
|
||||
struct hmapx mirror_output_ports;
|
||||
const char *hwaddr;
|
||||
struct port *port;
|
||||
bool found_addr = false;
|
||||
int error;
|
||||
int i;
|
||||
|
||||
*hw_addr_iface = NULL;
|
||||
|
||||
/* Did the user request a particular MAC? */
|
||||
hwaddr = smap_get(&br->cfg->other_config, "hwaddr");
|
||||
if (hwaddr && eth_addr_from_string(hwaddr, ea)) {
|
||||
if (eth_addr_is_multicast(ea)) {
|
||||
VLOG_ERR("bridge %s: cannot set MAC address to multicast "
|
||||
"address "ETH_ADDR_FMT, br->name, ETH_ADDR_ARGS(ea));
|
||||
} else if (eth_addr_is_zero(ea)) {
|
||||
VLOG_ERR("bridge %s: cannot set MAC address to zero", br->name);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mirror output ports don't participate in picking the local hardware
|
||||
* address. ofproto can't help us find out whether a given port is a
|
||||
* mirror output because we haven't configured mirrors yet, so we need to
|
||||
@@ -1656,6 +1640,30 @@ bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
|
||||
hmapx_destroy(&mirror_output_ports);
|
||||
}
|
||||
|
||||
static void
|
||||
bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
|
||||
struct iface **hw_addr_iface)
|
||||
{
|
||||
const char *hwaddr;
|
||||
*hw_addr_iface = NULL;
|
||||
|
||||
/* Did the user request a particular MAC? */
|
||||
hwaddr = smap_get(&br->cfg->other_config, "hwaddr");
|
||||
if (hwaddr && eth_addr_from_string(hwaddr, ea)) {
|
||||
if (eth_addr_is_multicast(ea)) {
|
||||
VLOG_ERR("bridge %s: cannot set MAC address to multicast "
|
||||
"address "ETH_ADDR_FMT, br->name, ETH_ADDR_ARGS(ea));
|
||||
} else if (eth_addr_is_zero(ea)) {
|
||||
VLOG_ERR("bridge %s: cannot set MAC address to zero", br->name);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find a local hw address */
|
||||
find_local_hw_addr(br, ea, hw_addr_iface);
|
||||
}
|
||||
|
||||
/* Choose and returns the datapath ID for bridge 'br' given that the bridge
|
||||
* Ethernet address is 'bridge_ea'. If 'bridge_ea' is the Ethernet address of
|
||||
* an interface on 'br', then that interface must be passed in as
|
||||
|
Reference in New Issue
Block a user