Commit c20811a7 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

bonding: move dev_addr cpy to bond_enslave

Move the code that copies slave's mac address in case that's the first slave into
bond_enslave. Ifenslave app does this also but that's not a problem. This is
something that should be done in bond_enslave, and it shound not matter from
where is it called.
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e9509554
...@@ -1522,6 +1522,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1522,6 +1522,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
} }
} }
/* If this is the first slave, then we need to set the master's hardware
* address to be the same as the slave's. */
if (bond->slave_cnt == 0)
memcpy(bond->dev->dev_addr, slave_dev->dev_addr,
slave_dev->addr_len);
new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL); new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
if (!new_slave) { if (!new_slave) {
res = -ENOMEM; res = -ENOMEM;
......
...@@ -250,14 +250,6 @@ static ssize_t bonding_store_slaves(struct device *d, ...@@ -250,14 +250,6 @@ static ssize_t bonding_store_slaves(struct device *d,
switch (command[0]) { switch (command[0]) {
case '+': case '+':
pr_info("%s: Adding slave %s.\n", bond->dev->name, dev->name); pr_info("%s: Adding slave %s.\n", bond->dev->name, dev->name);
/* If this is the first slave, then we need to set
the master's hardware address to be the same as the
slave's. */
if (is_zero_ether_addr(bond->dev->dev_addr))
memcpy(bond->dev->dev_addr, dev->dev_addr,
dev->addr_len);
res = bond_enslave(bond->dev, dev); res = bond_enslave(bond->dev, dev);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment