Commit 0e5ded5a authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

mac80211: allow station updates on ap interfaces for vlan stations

Since the per-vif station changes, sta_info_get on the ap sdata no
longer returns entries for stations on ap vlans. This causes issues
with hostapd, which currently always passes the ap interface name to
nl80211 calls. This patch provides bug compatibility with the earlier
versions until hostapd is fixed.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d524215f
...@@ -148,7 +148,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, ...@@ -148,7 +148,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
rcu_read_lock(); rcu_read_lock();
if (mac_addr) { if (mac_addr) {
sta = sta_info_get(sdata, mac_addr); sta = sta_info_get_bss(sdata, mac_addr);
if (!sta) { if (!sta) {
ieee80211_key_free(key); ieee80211_key_free(key);
err = -ENOENT; err = -ENOENT;
...@@ -179,7 +179,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, ...@@ -179,7 +179,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
if (mac_addr) { if (mac_addr) {
ret = -ENOENT; ret = -ENOENT;
sta = sta_info_get(sdata, mac_addr); sta = sta_info_get_bss(sdata, mac_addr);
if (!sta) if (!sta)
goto out_unlock; goto out_unlock;
...@@ -226,7 +226,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, ...@@ -226,7 +226,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
rcu_read_lock(); rcu_read_lock();
if (mac_addr) { if (mac_addr) {
sta = sta_info_get(sdata, mac_addr); sta = sta_info_get_bss(sdata, mac_addr);
if (!sta) if (!sta)
goto out; goto out;
...@@ -419,7 +419,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -419,7 +419,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(sdata, mac); sta = sta_info_get_bss(sdata, mac);
if (sta) { if (sta) {
ret = 0; ret = 0;
sta_set_sinfo(sta, sinfo); sta_set_sinfo(sta, sinfo);
...@@ -775,7 +775,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -775,7 +775,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
if (mac) { if (mac) {
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(sdata, mac); sta = sta_info_get_bss(sdata, mac);
if (!sta) { if (!sta) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT; return -ENOENT;
...@@ -803,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, ...@@ -803,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(sdata, mac); sta = sta_info_get_bss(sdata, mac);
if (!sta) { if (!sta) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT; return -ENOENT;
......
...@@ -119,6 +119,27 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, ...@@ -119,6 +119,27 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
return sta; return sta;
} }
/*
* Get sta info either from the specified interface
* or from one of its vlans
*/
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
const u8 *addr)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
while (sta) {
if ((sta->sdata == sdata ||
sta->sdata->bss == sdata->bss) &&
memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
break;
sta = rcu_dereference(sta->hnext);
}
return sta;
}
struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
int idx) int idx)
{ {
......
...@@ -408,6 +408,9 @@ static inline u32 get_sta_flags(struct sta_info *sta) ...@@ -408,6 +408,9 @@ static inline u32 get_sta_flags(struct sta_info *sta)
struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
const u8 *addr); const u8 *addr);
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
const u8 *addr);
static inline static inline
void for_each_sta_info_type_check(struct ieee80211_local *local, void for_each_sta_info_type_check(struct ieee80211_local *local,
const u8 *addr, const u8 *addr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment