struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)];
        struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)];
 
+       struct mac_address addresses[2];
+
        struct ieee80211_channel *channel;
        unsigned long beacon_int; /* in jiffies unit */
        unsigned int rx_filter;
                SET_IEEE80211_DEV(hw, data->dev);
                addr[3] = i >> 8;
                addr[4] = i;
-               SET_IEEE80211_PERM_ADDR(hw, addr);
+               memcpy(data->addresses[0].addr, addr, ETH_ALEN);
+               memcpy(data->addresses[1].addr, addr, ETH_ALEN);
+               data->addresses[1].addr[0] |= 0x40;
+               hw->wiphy->n_addresses = 2;
+               hw->wiphy->addresses = data->addresses;
 
                hw->channel_change_time = 1;
                hw->queues = 4;
 
        WIPHY_FLAG_4ADDR_STATION        = BIT(6),
 };
 
+struct mac_address {
+       u8 addr[ETH_ALEN];
+};
+
 /**
  * struct wiphy - wireless hardware description
  * @idx: the wiphy index assigned to this item
  *     -1 = fragmentation disabled, only odd values >= 256 used
  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
  * @net: the network namespace this wiphy currently lives in
+ * @perm_addr: permanent MAC address of this device
+ * @addr_mask: If the device supports multiple MAC addresses by masking,
+ *     set this to a mask with variable bits set to 1, e.g. if the last
+ *     four bits are variable then set it to 00:...:00:0f. The actual
+ *     variable bits shall be determined by the interfaces added, with
+ *     interfaces not matching the mask being rejected to be brought up.
+ * @n_addresses: number of addresses in @addresses.
+ * @addresses: If the device has more than one address, set this pointer
+ *     to a list of addresses (6 bytes each). The first one will be used
+ *     by default for perm_addr. In this case, the mask should be set to
+ *     all-zeroes. In this case it is assumed that the device can handle
+ *     the same number of arbitrary MAC addresses.
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
 
-       /* permanent MAC address */
+       /* permanent MAC address(es) */
        u8 perm_addr[ETH_ALEN];
+       u8 addr_mask[ETH_ALEN];
+
+       u16 n_addresses;
+       struct mac_address *addresses;
 
        /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
        u16 interface_modes;
 
        int i;
        u16 ifmodes = wiphy->interface_modes;
 
+       if (WARN_ON(wiphy->addresses && !wiphy->n_addresses))
+               return -EINVAL;
+
+       if (WARN_ON(wiphy->addresses &&
+                   !is_zero_ether_addr(wiphy->perm_addr) &&
+                   memcmp(wiphy->perm_addr, wiphy->addresses[0].addr,
+                          ETH_ALEN)))
+               return -EINVAL;
+
+       if (wiphy->addresses)
+               memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN);
+
        /* sanity check ifmodes */
        WARN_ON(!ifmodes);
        ifmodes &= ((1 << __NL80211_IFTYPE_AFTER_LAST) - 1) & ~1;
 
 
 SHOW_FMT(index, "%d", wiphy_idx);
 SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
+SHOW_FMT(address_mask, "%pM", wiphy.addr_mask);
+
+static ssize_t addresses_show(struct device *dev,
+                             struct device_attribute *attr,
+                             char *buf)
+{
+       struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
+       char *start = buf;
+       int i;
+
+       if (!wiphy->addresses)
+               return sprintf(buf, "%pM\n", wiphy->perm_addr);
+
+       for (i = 0; i < wiphy->n_addresses; i++)
+               buf += sprintf(buf, "%pM\n", &wiphy->addresses[i].addr);
+
+       return buf - start;
+}
 
 static struct device_attribute ieee80211_dev_attrs[] = {
        __ATTR_RO(index),
        __ATTR_RO(macaddress),
+       __ATTR_RO(address_mask),
+       __ATTR_RO(addresses),
        {}
 };