cfg80211: allow leaving MU-MIMO monitor configuration unchanged

When changing monitor parameters, not setting the MU-MIMO attributes
should mean that they're not changed - it's documented that to turn
the feature off it's necessary to set all-zero group membership and
an invalid follow-address. This isn't implemented.

Fix this by making the parameters pointers, stop reusing the macaddr
struct member, and documenting that NULL pointers mean unchanged.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2017-04-12 10:43:49 +02:00
Родитель 30841f5cde
Коммит b0265024b8
3 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -370,13 +370,16 @@ static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
* This feature is only fully supported by drivers that enable the * This feature is only fully supported by drivers that enable the
* %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
** only p2p devices with specified MAC. ** only p2p devices with specified MAC.
* @vht_mumimo_groups: MU-MIMO groupID. used for monitoring only * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
* packets belonging to that MU-MIMO groupID. * belonging to that MU-MIMO groupID; %NULL if not changed
* @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
* MU-MIMO packets going to the specified station; %NULL if not changed
*/ */
struct vif_params { struct vif_params {
int use_4addr; int use_4addr;
u8 macaddr[ETH_ALEN]; u8 macaddr[ETH_ALEN];
u8 vht_mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN]; const u8 *vht_mumimo_groups;
const u8 *vht_mumimo_follow_addr;
}; };
/** /**

Просмотреть файл

@ -80,8 +80,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
u32 mu_mntr_cap_flag = NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER; u32 mu_mntr_cap_flag = NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER;
monitor_sdata = rtnl_dereference(local->monitor_sdata); monitor_sdata = rtnl_dereference(local->monitor_sdata);
if (monitor_sdata && if (monitor_sdata && params->vht_mumimo_groups) {
wiphy_ext_feature_isset(wiphy, mu_mntr_cap_flag)) {
memcpy(monitor_sdata->vif.bss_conf.mu_group.membership, memcpy(monitor_sdata->vif.bss_conf.mu_group.membership,
params->vht_mumimo_groups, WLAN_MEMBERSHIP_LEN); params->vht_mumimo_groups, WLAN_MEMBERSHIP_LEN);
memcpy(monitor_sdata->vif.bss_conf.mu_group.position, memcpy(monitor_sdata->vif.bss_conf.mu_group.position,
@ -90,11 +89,12 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
monitor_sdata->vif.mu_mimo_owner = true; monitor_sdata->vif.mu_mimo_owner = true;
ieee80211_bss_info_change_notify(monitor_sdata, ieee80211_bss_info_change_notify(monitor_sdata,
BSS_CHANGED_MU_GROUPS); BSS_CHANGED_MU_GROUPS);
ether_addr_copy(monitor_sdata->u.mntr.mu_follow_addr,
params->macaddr);
} }
if (monitor_sdata && params->vht_mumimo_follow_addr)
ether_addr_copy(monitor_sdata->u.mntr.mu_follow_addr,
params->vht_mumimo_follow_addr);
if (!flags) if (!flags)
return 0; return 0;

Просмотреть файл

@ -2832,8 +2832,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
(mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN - 1] & BIT(0))) (mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN - 1] & BIT(0)))
return -EINVAL; return -EINVAL;
memcpy(params.vht_mumimo_groups, mumimo_groups, params.vht_mumimo_groups = mumimo_groups;
VHT_MUMIMO_GROUPS_DATA_LEN);
change = true; change = true;
} }
@ -2843,9 +2842,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
if (!wiphy_ext_feature_isset(&rdev->wiphy, cap_flag)) if (!wiphy_ext_feature_isset(&rdev->wiphy, cap_flag))
return -EOPNOTSUPP; return -EOPNOTSUPP;
nla_memcpy(params.macaddr, params.vht_mumimo_follow_addr =
info->attrs[NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR], nla_data(info->attrs[NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR]);
ETH_ALEN);
change = true; change = true;
} }