BACKPORT: FROMGIT: wifi: nl80211: update add/remove link command

For now, we only expect to add links on AP interfaces, we
should not be able to remove links on client interfaces
even if they have valid links due to making a connection.

Also add a note that we should clean up a link when we
remove it, we'll need to address that later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 233387627
Change-Id: I949389e58958d6d79d25d473c00ee1d8d6a73a28
(cherry picked from commit 945b73e8b8069bbefcb07f4ce2a1c1793db1c058
 https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git mld)
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
Johannes Berg 2022-06-10 11:05:26 +02:00 committed by Carlos Llamas
parent 3f048cd911
commit e1913fb476
1 changed files with 9 additions and 1 deletions

View File

@ -15555,7 +15555,6 @@ static int nl80211_add_link(struct sk_buff *skb, struct genl_info *info)
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_STATION:
break;
default:
return -EINVAL;
@ -15582,6 +15581,15 @@ static int nl80211_remove_link(struct sk_buff *skb, struct genl_info *info)
if (!info->attrs[NL80211_ATTR_MLO_LINK_ID])
return -EINVAL;
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
break;
default:
return -EINVAL;
}
/* FIXME: stop the link operations first */
wdev->valid_links &= ~BIT(link_id);
eth_zero_addr(wdev->links[link_id].addr);