--- zzzz-none-000/linux-2.6.39.4/net/bridge/br_device.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/net/bridge/br_device.c 2021-11-10 13:23:11.000000000 +0000 @@ -152,18 +152,24 @@ } /* Allow setting mac address to any valid ethernet address. */ -static int br_set_mac_address(struct net_device *dev, void *p) +static int br_set_mac_address(struct net_device *dev, void *addr_struct_p) { - struct net_bridge *br = netdev_priv(dev); - struct sockaddr *addr = p; - - if (!is_valid_ether_addr(addr->sa_data)) - return -EINVAL; + struct net_bridge *br; + struct sockaddr *addr = (struct sockaddr *)(addr_struct_p); + unsigned char br_mac_zero[6] = {0,0,0,0,0,0}; + br = netdev_priv(dev); spin_lock_bh(&br->lock); - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); - br_stp_change_bridge_id(br, addr->sa_data); - br->flags |= BR_SET_MAC_ADDR; + + if (!memcmp(addr->sa_data, br_mac_zero, ETH_ALEN)) { + if (br->automatic_mac_disabled) { + br->automatic_mac_disabled = 0; + br_stp_recalculate_bridge_id(br); + } + } else { + br->automatic_mac_disabled = 1; + br_stp_set_bridge_id(br, addr->sa_data); + } spin_unlock_bh(&br->lock); return 0;