mac80211: support creating vifs with specified mac address
authorBen Greear <greearb@candelatech.com>
Wed, 22 Oct 2014 19:23:06 +0000 (12:23 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 27 Oct 2014 07:48:34 +0000 (08:48 +0100)
This is useful when creating virtual interfaces.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c
net/mac80211/main.c

index e469b3390f2a614ab9628ca927be8ba7bcf2a509..1ffcc070124490e8a55f528f76e248efe3d73673 100644 (file)
@@ -1671,7 +1671,10 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
                }
 
                ieee80211_assign_perm_addr(local, ndev->perm_addr, type);
-               memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
+               if (params && is_valid_ether_addr(params->macaddr))
+                       memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN);
+               else
+                       memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
                SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
 
                /* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */
index 7d40e3f0a77be0141826caea0fd2ef3ca11f0727..282a4f36eb924f1fc51ebb75726d87eeaee2e38f 100644 (file)
@@ -542,6 +542,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
                           NL80211_FEATURE_SAE |
                           NL80211_FEATURE_HT_IBSS |
                           NL80211_FEATURE_VIF_TXPOWER |
+                          NL80211_FEATURE_MAC_ON_CREATE |
                           NL80211_FEATURE_USERSPACE_MPM;
 
        if (!ops->hw_scan)