@@ -31,7 +31,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata;
int err;
- err = ieee80211_if_add(local, name, &wdev, type, params);
+ err = ieee80211_if_add(local, name, &wdev, type, flags, params);
if (err)
return ERR_PTR(err);
@@ -1345,7 +1345,7 @@ int ieee80211_iface_init(void);
void ieee80211_iface_exit(void);
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct wireless_dev **new_wdev, enum nl80211_iftype type,
- struct vif_params *params);
+ u32 *flags, struct vif_params *params);
int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
enum nl80211_iftype type);
void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
@@ -1493,7 +1493,8 @@ static void __ieee80211_assign_perm_addr(struct ieee80211_local *local,
}
static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
- u8 *perm_addr, enum nl80211_iftype type)
+ u8 *perm_addr, enum nl80211_iftype type,
+ u32 *flags)
{
struct ieee80211_sub_if_data *sdata;
@@ -1517,7 +1518,8 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
switch (type) {
case NL80211_IFTYPE_MONITOR:
- /* doesn't matter */
+ if (flags && (*flags & MONITOR_FLAG_ACTIVE))
+ __ieee80211_assign_perm_addr(local, perm_addr);
break;
case NL80211_IFTYPE_WDS:
case NL80211_IFTYPE_AP_VLAN:
@@ -1563,7 +1565,7 @@ static void ieee80211_cleanup_sdata_stas_wk(struct work_struct *wk)
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct wireless_dev **new_wdev, enum nl80211_iftype type,
- struct vif_params *params)
+ u32 *flags, struct vif_params *params)
{
struct net_device *ndev = NULL;
struct ieee80211_sub_if_data *sdata = NULL;
@@ -1583,7 +1585,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
sdata->dev = NULL;
strlcpy(sdata->name, name, IFNAMSIZ);
- ieee80211_assign_perm_addr(local, wdev->address, type);
+ ieee80211_assign_perm_addr(local, wdev->address, type, flags);
memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
} else {
if (local->hw.queues >= IEEE80211_NUM_ACS)
@@ -1611,7 +1613,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
return ret;
}
- ieee80211_assign_perm_addr(local, ndev->perm_addr, type);
+ ieee80211_assign_perm_addr(local, ndev->perm_addr, type, flags);
memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
@@ -968,7 +968,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
/* add one default STA interface if supported */
if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
result = ieee80211_if_add(local, "wlan%d", NULL,
- NL80211_IFTYPE_STATION, NULL);
+ NL80211_IFTYPE_STATION, NULL, NULL);
if (result)
wiphy_warn(local->hw.wiphy,
"Failed to add default virtual iface\n");