aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bonding/bond_alb.c88
-rw-r--r--drivers/net/bonding/bond_main.c73
-rw-r--r--drivers/net/bonding/bond_procfs.c3
-rw-r--r--include/net/bonding.h12
4 files changed, 108 insertions, 68 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index c80b023092dd..7d7a3cec149a 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -687,7 +687,8 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
687 /* the arp must be sent on the selected rx channel */ 687 /* the arp must be sent on the selected rx channel */
688 tx_slave = rlb_choose_channel(skb, bond); 688 tx_slave = rlb_choose_channel(skb, bond);
689 if (tx_slave) 689 if (tx_slave)
690 ether_addr_copy(arp->mac_src, tx_slave->dev->dev_addr); 690 bond_hw_addr_copy(arp->mac_src, tx_slave->dev->dev_addr,
691 tx_slave->dev->addr_len);
691 netdev_dbg(bond->dev, "Server sent ARP Reply packet\n"); 692 netdev_dbg(bond->dev, "Server sent ARP Reply packet\n");
692 } else if (arp->op_code == htons(ARPOP_REQUEST)) { 693 } else if (arp->op_code == htons(ARPOP_REQUEST)) {
693 /* Create an entry in the rx_hashtbl for this client as a 694 /* Create an entry in the rx_hashtbl for this client as a
@@ -1017,22 +1018,23 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
1017 rcu_read_unlock(); 1018 rcu_read_unlock();
1018} 1019}
1019 1020
1020static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[]) 1021static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[],
1022 unsigned int len)
1021{ 1023{
1022 struct net_device *dev = slave->dev; 1024 struct net_device *dev = slave->dev;
1023 struct sockaddr s_addr; 1025 struct sockaddr_storage ss;
1024 1026
1025 if (BOND_MODE(slave->bond) == BOND_MODE_TLB) { 1027 if (BOND_MODE(slave->bond) == BOND_MODE_TLB) {
1026 memcpy(dev->dev_addr, addr, dev->addr_len); 1028 memcpy(dev->dev_addr, addr, len);
1027 return 0; 1029 return 0;
1028 } 1030 }
1029 1031
1030 /* for rlb each slave must have a unique hw mac addresses so that 1032 /* for rlb each slave must have a unique hw mac addresses so that
1031 * each slave will receive packets destined to a different mac 1033 * each slave will receive packets destined to a different mac
1032 */ 1034 */
1033 memcpy(s_addr.sa_data, addr, dev->addr_len); 1035 memcpy(ss.__data, addr, len);
1034 s_addr.sa_family = dev->type; 1036 ss.ss_family = dev->type;
1035 if (dev_set_mac_address(dev, &s_addr)) { 1037 if (dev_set_mac_address(dev, (struct sockaddr *)&ss)) {
1036 netdev_err(slave->bond->dev, "dev_set_mac_address of dev %s failed! ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n", 1038 netdev_err(slave->bond->dev, "dev_set_mac_address of dev %s failed! ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n",
1037 dev->name); 1039 dev->name);
1038 return -EOPNOTSUPP; 1040 return -EOPNOTSUPP;
@@ -1046,11 +1048,14 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
1046 */ 1048 */
1047static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2) 1049static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
1048{ 1050{
1049 u8 tmp_mac_addr[ETH_ALEN]; 1051 u8 tmp_mac_addr[MAX_ADDR_LEN];
1050 1052
1051 ether_addr_copy(tmp_mac_addr, slave1->dev->dev_addr); 1053 bond_hw_addr_copy(tmp_mac_addr, slave1->dev->dev_addr,
1052 alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr); 1054 slave1->dev->addr_len);
1053 alb_set_slave_mac_addr(slave2, tmp_mac_addr); 1055 alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr,
1056 slave2->dev->addr_len);
1057 alb_set_slave_mac_addr(slave2, tmp_mac_addr,
1058 slave1->dev->addr_len);
1054 1059
1055} 1060}
1056 1061
@@ -1177,7 +1182,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1177 /* Try setting slave mac to bond address and fall-through 1182 /* Try setting slave mac to bond address and fall-through
1178 * to code handling that situation below... 1183 * to code handling that situation below...
1179 */ 1184 */
1180 alb_set_slave_mac_addr(slave, bond->dev->dev_addr); 1185 alb_set_slave_mac_addr(slave, bond->dev->dev_addr,
1186 bond->dev->addr_len);
1181 } 1187 }
1182 1188
1183 /* The slave's address is equal to the address of the bond. 1189 /* The slave's address is equal to the address of the bond.
@@ -1202,7 +1208,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
1202 } 1208 }
1203 1209
1204 if (free_mac_slave) { 1210 if (free_mac_slave) {
1205 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr); 1211 alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
1212 free_mac_slave->dev->addr_len);
1206 1213
1207 netdev_warn(bond->dev, "the hw address of slave %s is in use by the bond; giving it the hw address of %s\n", 1214 netdev_warn(bond->dev, "the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
1208 slave->dev->name, free_mac_slave->dev->name); 1215 slave->dev->name, free_mac_slave->dev->name);
@@ -1234,8 +1241,8 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
1234{ 1241{
1235 struct slave *slave, *rollback_slave; 1242 struct slave *slave, *rollback_slave;
1236 struct list_head *iter; 1243 struct list_head *iter;
1237 struct sockaddr sa; 1244 struct sockaddr_storage ss;
1238 char tmp_addr[ETH_ALEN]; 1245 char tmp_addr[MAX_ADDR_LEN];
1239 int res; 1246 int res;
1240 1247
1241 if (bond->alb_info.rlb_enabled) 1248 if (bond->alb_info.rlb_enabled)
@@ -1243,12 +1250,14 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
1243 1250
1244 bond_for_each_slave(bond, slave, iter) { 1251 bond_for_each_slave(bond, slave, iter) {
1245 /* save net_device's current hw address */ 1252 /* save net_device's current hw address */
1246 ether_addr_copy(tmp_addr, slave->dev->dev_addr); 1253 bond_hw_addr_copy(tmp_addr, slave->dev->dev_addr,
1254 slave->dev->addr_len);
1247 1255
1248 res = dev_set_mac_address(slave->dev, addr); 1256 res = dev_set_mac_address(slave->dev, addr);
1249 1257
1250 /* restore net_device's hw address */ 1258 /* restore net_device's hw address */
1251 ether_addr_copy(slave->dev->dev_addr, tmp_addr); 1259 bond_hw_addr_copy(slave->dev->dev_addr, tmp_addr,
1260 slave->dev->addr_len);
1252 1261
1253 if (res) 1262 if (res)
1254 goto unwind; 1263 goto unwind;
@@ -1257,16 +1266,19 @@ static int alb_set_mac_address(struct bonding *bond, void *addr)
1257 return 0; 1266 return 0;
1258 1267
1259unwind: 1268unwind:
1260 memcpy(sa.sa_data, bond->dev->dev_addr, bond->dev->addr_len); 1269 memcpy(ss.__data, bond->dev->dev_addr, bond->dev->addr_len);
1261 sa.sa_family = bond->dev->type; 1270 ss.ss_family = bond->dev->type;
1262 1271
1263 /* unwind from head to the slave that failed */ 1272 /* unwind from head to the slave that failed */
1264 bond_for_each_slave(bond, rollback_slave, iter) { 1273 bond_for_each_slave(bond, rollback_slave, iter) {
1265 if (rollback_slave == slave) 1274 if (rollback_slave == slave)
1266 break; 1275 break;
1267 ether_addr_copy(tmp_addr, rollback_slave->dev->dev_addr); 1276 bond_hw_addr_copy(tmp_addr, rollback_slave->dev->dev_addr,
1268 dev_set_mac_address(rollback_slave->dev, &sa); 1277 rollback_slave->dev->addr_len);
1269 ether_addr_copy(rollback_slave->dev->dev_addr, tmp_addr); 1278 dev_set_mac_address(rollback_slave->dev,
1279 (struct sockaddr *)&ss);
1280 bond_hw_addr_copy(rollback_slave->dev->dev_addr, tmp_addr,
1281 rollback_slave->dev->addr_len);
1270 } 1282 }
1271 1283
1272 return res; 1284 return res;
@@ -1582,7 +1594,8 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1582{ 1594{
1583 int res; 1595 int res;
1584 1596
1585 res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr); 1597 res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr,
1598 slave->dev->addr_len);
1586 if (res) 1599 if (res)
1587 return res; 1600 return res;
1588 1601
@@ -1696,17 +1709,20 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1696 * and thus filter bond->dev_addr's packets, so force bond's mac 1709 * and thus filter bond->dev_addr's packets, so force bond's mac
1697 */ 1710 */
1698 if (BOND_MODE(bond) == BOND_MODE_TLB) { 1711 if (BOND_MODE(bond) == BOND_MODE_TLB) {
1699 struct sockaddr sa; 1712 struct sockaddr_storage ss;
1700 u8 tmp_addr[ETH_ALEN]; 1713 u8 tmp_addr[MAX_ADDR_LEN];
1701 1714
1702 ether_addr_copy(tmp_addr, new_slave->dev->dev_addr); 1715 bond_hw_addr_copy(tmp_addr, new_slave->dev->dev_addr,
1716 new_slave->dev->addr_len);
1703 1717
1704 memcpy(sa.sa_data, bond->dev->dev_addr, bond->dev->addr_len); 1718 bond_hw_addr_copy(ss.__data, bond->dev->dev_addr,
1705 sa.sa_family = bond->dev->type; 1719 bond->dev->addr_len);
1720 ss.ss_family = bond->dev->type;
1706 /* we don't care if it can't change its mac, best effort */ 1721 /* we don't care if it can't change its mac, best effort */
1707 dev_set_mac_address(new_slave->dev, &sa); 1722 dev_set_mac_address(new_slave->dev, (struct sockaddr *)&ss);
1708 1723
1709 ether_addr_copy(new_slave->dev->dev_addr, tmp_addr); 1724 bond_hw_addr_copy(new_slave->dev->dev_addr, tmp_addr,
1725 new_slave->dev->addr_len);
1710 } 1726 }
1711 1727
1712 /* curr_active_slave must be set before calling alb_swap_mac_addr */ 1728 /* curr_active_slave must be set before calling alb_swap_mac_addr */
@@ -1716,7 +1732,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1716 alb_fasten_mac_swap(bond, swap_slave, new_slave); 1732 alb_fasten_mac_swap(bond, swap_slave, new_slave);
1717 } else { 1733 } else {
1718 /* set the new_slave to the bond mac address */ 1734 /* set the new_slave to the bond mac address */
1719 alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr); 1735 alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr,
1736 bond->dev->addr_len);
1720 alb_send_learning_packets(new_slave, bond->dev->dev_addr, 1737 alb_send_learning_packets(new_slave, bond->dev->dev_addr,
1721 false); 1738 false);
1722 } 1739 }
@@ -1726,19 +1743,19 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1726int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) 1743int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1727{ 1744{
1728 struct bonding *bond = netdev_priv(bond_dev); 1745 struct bonding *bond = netdev_priv(bond_dev);
1729 struct sockaddr *sa = addr; 1746 struct sockaddr_storage *ss = addr;
1730 struct slave *curr_active; 1747 struct slave *curr_active;
1731 struct slave *swap_slave; 1748 struct slave *swap_slave;
1732 int res; 1749 int res;
1733 1750
1734 if (!is_valid_ether_addr(sa->sa_data)) 1751 if (!is_valid_ether_addr(ss->__data))
1735 return -EADDRNOTAVAIL; 1752 return -EADDRNOTAVAIL;
1736 1753
1737 res = alb_set_mac_address(bond, addr); 1754 res = alb_set_mac_address(bond, addr);
1738 if (res) 1755 if (res)
1739 return res; 1756 return res;
1740 1757
1741 memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); 1758 bond_hw_addr_copy(bond_dev->dev_addr, ss->__data, bond_dev->addr_len);
1742 1759
1743 /* If there is no curr_active_slave there is nothing else to do. 1760 /* If there is no curr_active_slave there is nothing else to do.
1744 * Otherwise we'll need to pass the new address to it and handle 1761 * Otherwise we'll need to pass the new address to it and handle
@@ -1754,7 +1771,8 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1754 alb_swap_mac_addr(swap_slave, curr_active); 1771 alb_swap_mac_addr(swap_slave, curr_active);
1755 alb_fasten_mac_swap(bond, swap_slave, curr_active); 1772 alb_fasten_mac_swap(bond, swap_slave, curr_active);
1756 } else { 1773 } else {
1757 alb_set_slave_mac_addr(curr_active, bond_dev->dev_addr); 1774 alb_set_slave_mac_addr(curr_active, bond_dev->dev_addr,
1775 bond_dev->addr_len);
1758 1776
1759 alb_send_learning_packets(curr_active, 1777 alb_send_learning_packets(curr_active,
1760 bond_dev->dev_addr, false); 1778 bond_dev->dev_addr, false);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 535388b15cde..aba7352906a5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -645,8 +645,8 @@ static void bond_do_fail_over_mac(struct bonding *bond,
645 struct slave *new_active, 645 struct slave *new_active,
646 struct slave *old_active) 646 struct slave *old_active)
647{ 647{
648 u8 tmp_mac[ETH_ALEN]; 648 u8 tmp_mac[MAX_ADDR_LEN];
649 struct sockaddr saddr; 649 struct sockaddr_storage ss;
650 int rv; 650 int rv;
651 651
652 switch (bond->params.fail_over_mac) { 652 switch (bond->params.fail_over_mac) {
@@ -666,16 +666,20 @@ static void bond_do_fail_over_mac(struct bonding *bond,
666 old_active = bond_get_old_active(bond, new_active); 666 old_active = bond_get_old_active(bond, new_active);
667 667
668 if (old_active) { 668 if (old_active) {
669 ether_addr_copy(tmp_mac, new_active->dev->dev_addr); 669 bond_hw_addr_copy(tmp_mac, new_active->dev->dev_addr,
670 ether_addr_copy(saddr.sa_data, 670 new_active->dev->addr_len);
671 old_active->dev->dev_addr); 671 bond_hw_addr_copy(ss.__data,
672 saddr.sa_family = new_active->dev->type; 672 old_active->dev->dev_addr,
673 old_active->dev->addr_len);
674 ss.ss_family = new_active->dev->type;
673 } else { 675 } else {
674 ether_addr_copy(saddr.sa_data, bond->dev->dev_addr); 676 bond_hw_addr_copy(ss.__data, bond->dev->dev_addr,
675 saddr.sa_family = bond->dev->type; 677 bond->dev->addr_len);
678 ss.ss_family = bond->dev->type;
676 } 679 }
677 680
678 rv = dev_set_mac_address(new_active->dev, &saddr); 681 rv = dev_set_mac_address(new_active->dev,
682 (struct sockaddr *)&ss);
679 if (rv) { 683 if (rv) {
680 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", 684 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n",
681 -rv, new_active->dev->name); 685 -rv, new_active->dev->name);
@@ -685,10 +689,12 @@ static void bond_do_fail_over_mac(struct bonding *bond,
685 if (!old_active) 689 if (!old_active)
686 goto out; 690 goto out;
687 691
688 ether_addr_copy(saddr.sa_data, tmp_mac); 692 bond_hw_addr_copy(ss.__data, tmp_mac,
689 saddr.sa_family = old_active->dev->type; 693 new_active->dev->addr_len);
694 ss.ss_family = old_active->dev->type;
690 695
691 rv = dev_set_mac_address(old_active->dev, &saddr); 696 rv = dev_set_mac_address(old_active->dev,
697 (struct sockaddr *)&ss);
692 if (rv) 698 if (rv)
693 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n", 699 netdev_err(bond->dev, "Error %d setting MAC of slave %s\n",
694 -rv, new_active->dev->name); 700 -rv, new_active->dev->name);
@@ -1184,7 +1190,8 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
1184 kfree_skb(skb); 1190 kfree_skb(skb);
1185 return RX_HANDLER_CONSUMED; 1191 return RX_HANDLER_CONSUMED;
1186 } 1192 }
1187 ether_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr); 1193 bond_hw_addr_copy(eth_hdr(skb)->h_dest, bond->dev->dev_addr,
1194 bond->dev->addr_len);
1188 } 1195 }
1189 1196
1190 return ret; 1197 return ret;
@@ -1323,7 +1330,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1323 struct bonding *bond = netdev_priv(bond_dev); 1330 struct bonding *bond = netdev_priv(bond_dev);
1324 const struct net_device_ops *slave_ops = slave_dev->netdev_ops; 1331 const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
1325 struct slave *new_slave = NULL, *prev_slave; 1332 struct slave *new_slave = NULL, *prev_slave;
1326 struct sockaddr addr; 1333 struct sockaddr_storage ss;
1327 int link_reporting; 1334 int link_reporting;
1328 int res = 0, i; 1335 int res = 0, i;
1329 1336
@@ -1474,16 +1481,17 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1474 * that need it, and for restoring it upon release, and then 1481 * that need it, and for restoring it upon release, and then
1475 * set it to the master's address 1482 * set it to the master's address
1476 */ 1483 */
1477 ether_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr); 1484 bond_hw_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr,
1485 slave_dev->addr_len);
1478 1486
1479 if (!bond->params.fail_over_mac || 1487 if (!bond->params.fail_over_mac ||
1480 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { 1488 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
1481 /* Set slave to master's mac address. The application already 1489 /* Set slave to master's mac address. The application already
1482 * set the master's mac address to that of the first slave 1490 * set the master's mac address to that of the first slave
1483 */ 1491 */
1484 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); 1492 memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
1485 addr.sa_family = slave_dev->type; 1493 ss.ss_family = slave_dev->type;
1486 res = dev_set_mac_address(slave_dev, &addr); 1494 res = dev_set_mac_address(slave_dev, (struct sockaddr *)&ss);
1487 if (res) { 1495 if (res) {
1488 netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res); 1496 netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res);
1489 goto err_restore_mtu; 1497 goto err_restore_mtu;
@@ -1767,9 +1775,10 @@ err_restore_mac:
1767 * MAC if this slave's MAC is in use by the bond, or at 1775 * MAC if this slave's MAC is in use by the bond, or at
1768 * least print a warning. 1776 * least print a warning.
1769 */ 1777 */
1770 ether_addr_copy(addr.sa_data, new_slave->perm_hwaddr); 1778 bond_hw_addr_copy(ss.__data, new_slave->perm_hwaddr,
1771 addr.sa_family = slave_dev->type; 1779 new_slave->dev->addr_len);
1772 dev_set_mac_address(slave_dev, &addr); 1780 ss.ss_family = slave_dev->type;
1781 dev_set_mac_address(slave_dev, (struct sockaddr *)&ss);
1773 } 1782 }
1774 1783
1775err_restore_mtu: 1784err_restore_mtu:
@@ -1812,7 +1821,7 @@ static int __bond_release_one(struct net_device *bond_dev,
1812{ 1821{
1813 struct bonding *bond = netdev_priv(bond_dev); 1822 struct bonding *bond = netdev_priv(bond_dev);
1814 struct slave *slave, *oldcurrent; 1823 struct slave *slave, *oldcurrent;
1815 struct sockaddr addr; 1824 struct sockaddr_storage ss;
1816 int old_flags = bond_dev->flags; 1825 int old_flags = bond_dev->flags;
1817 netdev_features_t old_features = bond_dev->features; 1826 netdev_features_t old_features = bond_dev->features;
1818 1827
@@ -1947,9 +1956,10 @@ static int __bond_release_one(struct net_device *bond_dev,
1947 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE || 1956 if (bond->params.fail_over_mac != BOND_FOM_ACTIVE ||
1948 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { 1957 BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
1949 /* restore original ("permanent") mac address */ 1958 /* restore original ("permanent") mac address */
1950 ether_addr_copy(addr.sa_data, slave->perm_hwaddr); 1959 bond_hw_addr_copy(ss.__data, slave->perm_hwaddr,
1951 addr.sa_family = slave_dev->type; 1960 slave->dev->addr_len);
1952 dev_set_mac_address(slave_dev, &addr); 1961 ss.ss_family = slave_dev->type;
1962 dev_set_mac_address(slave_dev, (struct sockaddr *)&ss);
1953 } 1963 }
1954 1964
1955 dev_set_mtu(slave_dev, slave->original_mtu); 1965 dev_set_mtu(slave_dev, slave->original_mtu);
@@ -3626,7 +3636,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
3626{ 3636{
3627 struct bonding *bond = netdev_priv(bond_dev); 3637 struct bonding *bond = netdev_priv(bond_dev);
3628 struct slave *slave, *rollback_slave; 3638 struct slave *slave, *rollback_slave;
3629 struct sockaddr *sa = addr, tmp_sa; 3639 struct sockaddr_storage *ss = addr, tmp_ss;
3630 struct list_head *iter; 3640 struct list_head *iter;
3631 int res = 0; 3641 int res = 0;
3632 3642
@@ -3643,7 +3653,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
3643 BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) 3653 BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
3644 return 0; 3654 return 0;
3645 3655
3646 if (!is_valid_ether_addr(sa->sa_data)) 3656 if (!is_valid_ether_addr(ss->__data))
3647 return -EADDRNOTAVAIL; 3657 return -EADDRNOTAVAIL;
3648 3658
3649 bond_for_each_slave(bond, slave, iter) { 3659 bond_for_each_slave(bond, slave, iter) {
@@ -3662,12 +3672,12 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
3662 } 3672 }
3663 3673
3664 /* success */ 3674 /* success */
3665 memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); 3675 memcpy(bond_dev->dev_addr, ss->__data, bond_dev->addr_len);
3666 return 0; 3676 return 0;
3667 3677
3668unwind: 3678unwind:
3669 memcpy(tmp_sa.sa_data, bond_dev->dev_addr, bond_dev->addr_len); 3679 memcpy(tmp_ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
3670 tmp_sa.sa_family = bond_dev->type; 3680 tmp_ss.ss_family = bond_dev->type;
3671 3681
3672 /* unwind from head to the slave that failed */ 3682 /* unwind from head to the slave that failed */
3673 bond_for_each_slave(bond, rollback_slave, iter) { 3683 bond_for_each_slave(bond, rollback_slave, iter) {
@@ -3676,7 +3686,8 @@ unwind:
3676 if (rollback_slave == slave) 3686 if (rollback_slave == slave)
3677 break; 3687 break;
3678 3688
3679 tmp_res = dev_set_mac_address(rollback_slave->dev, &tmp_sa); 3689 tmp_res = dev_set_mac_address(rollback_slave->dev,
3690 (struct sockaddr *)&tmp_ss);
3680 if (tmp_res) { 3691 if (tmp_res) {
3681 netdev_dbg(bond_dev, "unwind err %d dev %s\n", 3692 netdev_dbg(bond_dev, "unwind err %d dev %s\n",
3682 tmp_res, rollback_slave->dev->name); 3693 tmp_res, rollback_slave->dev->name);
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index f514fe5e80a5..d8d4ada034b7 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -183,7 +183,8 @@ static void bond_info_show_slave(struct seq_file *seq,
183 seq_printf(seq, "Link Failure Count: %u\n", 183 seq_printf(seq, "Link Failure Count: %u\n",
184 slave->link_failure_count); 184 slave->link_failure_count);
185 185
186 seq_printf(seq, "Permanent HW addr: %pM\n", slave->perm_hwaddr); 186 seq_printf(seq, "Permanent HW addr: %*phC\n",
187 slave->dev->addr_len, slave->perm_hwaddr);
187 seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id); 188 seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
188 189
189 if (BOND_MODE(bond) == BOND_MODE_8023AD) { 190 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
diff --git a/include/net/bonding.h b/include/net/bonding.h
index fb2dd97857c4..04a21e8048be 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -166,7 +166,7 @@ struct slave {
166 u32 link_failure_count; 166 u32 link_failure_count;
167 u32 speed; 167 u32 speed;
168 u16 queue_id; 168 u16 queue_id;
169 u8 perm_hwaddr[ETH_ALEN]; 169 u8 perm_hwaddr[MAX_ADDR_LEN];
170 struct ad_slave_info *ad_info; 170 struct ad_slave_info *ad_info;
171 struct tlb_slave_info tlb_info; 171 struct tlb_slave_info tlb_info;
172#ifdef CONFIG_NET_POLL_CONTROLLER 172#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -402,6 +402,16 @@ static inline bool bond_slave_can_tx(struct slave *slave)
402 bond_is_active_slave(slave); 402 bond_is_active_slave(slave);
403} 403}
404 404
405static inline void bond_hw_addr_copy(u8 *dst, const u8 *src, unsigned int len)
406{
407 if (len == ETH_ALEN) {
408 ether_addr_copy(dst, src);
409 return;
410 }
411
412 memcpy(dst, src, len);
413}
414
405#define BOND_PRI_RESELECT_ALWAYS 0 415#define BOND_PRI_RESELECT_ALWAYS 0
406#define BOND_PRI_RESELECT_BETTER 1 416#define BOND_PRI_RESELECT_BETTER 1
407#define BOND_PRI_RESELECT_FAILURE 2 417#define BOND_PRI_RESELECT_FAILURE 2