Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e80cf853 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

cfg80211: disallow interfering with stations on non-AP



On non-AP interfaces userspace has no business interfering with
the station management, this can confuse mac80211 (and other
drivers probably wouldn't support it anyway). Allow adding and
removing stations only on AP interfaces.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 528769cf
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1746,6 +1746,12 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
	if (err)
		goto out_rtnl;

	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
		err = -EINVAL;
		goto out;
	}

	err = get_vlan(info->attrs[NL80211_ATTR_STA_VLAN], drv, &params.vlan);
	if (err)
		goto out;
@@ -1789,6 +1795,12 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
	if (err)
		goto out_rtnl;

	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
		err = -EINVAL;
		goto out;
	}

	if (!drv->ops->del_station) {
		err = -EOPNOTSUPP;
		goto out;