diff options
-rw-r--r-- | net/mac80211/cfg.c | 12 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 21 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 3 |
3 files changed, 30 insertions, 6 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index e5dda6fb8dff..dc12e9466ffd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -148,7 +148,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
148 | rcu_read_lock(); | 148 | rcu_read_lock(); |
149 | 149 | ||
150 | if (mac_addr) { | 150 | if (mac_addr) { |
151 | sta = sta_info_get(sdata, mac_addr); | 151 | sta = sta_info_get_bss(sdata, mac_addr); |
152 | if (!sta) { | 152 | if (!sta) { |
153 | ieee80211_key_free(key); | 153 | ieee80211_key_free(key); |
154 | err = -ENOENT; | 154 | err = -ENOENT; |
@@ -179,7 +179,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
179 | if (mac_addr) { | 179 | if (mac_addr) { |
180 | ret = -ENOENT; | 180 | ret = -ENOENT; |
181 | 181 | ||
182 | sta = sta_info_get(sdata, mac_addr); | 182 | sta = sta_info_get_bss(sdata, mac_addr); |
183 | if (!sta) | 183 | if (!sta) |
184 | goto out_unlock; | 184 | goto out_unlock; |
185 | 185 | ||
@@ -226,7 +226,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |||
226 | rcu_read_lock(); | 226 | rcu_read_lock(); |
227 | 227 | ||
228 | if (mac_addr) { | 228 | if (mac_addr) { |
229 | sta = sta_info_get(sdata, mac_addr); | 229 | sta = sta_info_get_bss(sdata, mac_addr); |
230 | if (!sta) | 230 | if (!sta) |
231 | goto out; | 231 | goto out; |
232 | 232 | ||
@@ -419,7 +419,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
419 | 419 | ||
420 | rcu_read_lock(); | 420 | rcu_read_lock(); |
421 | 421 | ||
422 | sta = sta_info_get(sdata, mac); | 422 | sta = sta_info_get_bss(sdata, mac); |
423 | if (sta) { | 423 | if (sta) { |
424 | ret = 0; | 424 | ret = 0; |
425 | sta_set_sinfo(sta, sinfo); | 425 | sta_set_sinfo(sta, sinfo); |
@@ -775,7 +775,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, | |||
775 | if (mac) { | 775 | if (mac) { |
776 | rcu_read_lock(); | 776 | rcu_read_lock(); |
777 | 777 | ||
778 | sta = sta_info_get(sdata, mac); | 778 | sta = sta_info_get_bss(sdata, mac); |
779 | if (!sta) { | 779 | if (!sta) { |
780 | rcu_read_unlock(); | 780 | rcu_read_unlock(); |
781 | return -ENOENT; | 781 | return -ENOENT; |
@@ -803,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
803 | 803 | ||
804 | rcu_read_lock(); | 804 | rcu_read_lock(); |
805 | 805 | ||
806 | sta = sta_info_get(sdata, mac); | 806 | sta = sta_info_get_bss(sdata, mac); |
807 | if (!sta) { | 807 | if (!sta) { |
808 | rcu_read_unlock(); | 808 | rcu_read_unlock(); |
809 | return -ENOENT; | 809 | return -ENOENT; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 47da552ce8a6..f735826f055c 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -119,6 +119,27 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, | |||
119 | return sta; | 119 | return sta; |
120 | } | 120 | } |
121 | 121 | ||
122 | /* | ||
123 | * Get sta info either from the specified interface | ||
124 | * or from one of its vlans | ||
125 | */ | ||
126 | struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, | ||
127 | const u8 *addr) | ||
128 | { | ||
129 | struct ieee80211_local *local = sdata->local; | ||
130 | struct sta_info *sta; | ||
131 | |||
132 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); | ||
133 | while (sta) { | ||
134 | if ((sta->sdata == sdata || | ||
135 | sta->sdata->bss == sdata->bss) && | ||
136 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | ||
137 | break; | ||
138 | sta = rcu_dereference(sta->hnext); | ||
139 | } | ||
140 | return sta; | ||
141 | } | ||
142 | |||
122 | struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, | 143 | struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, |
123 | int idx) | 144 | int idx) |
124 | { | 145 | { |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index c8208236e896..6f79bba5706e 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -408,6 +408,9 @@ static inline u32 get_sta_flags(struct sta_info *sta) | |||
408 | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, | 408 | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, |
409 | const u8 *addr); | 409 | const u8 *addr); |
410 | 410 | ||
411 | struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, | ||
412 | const u8 *addr); | ||
413 | |||
411 | static inline | 414 | static inline |
412 | void for_each_sta_info_type_check(struct ieee80211_local *local, | 415 | void for_each_sta_info_type_check(struct ieee80211_local *local, |
413 | const u8 *addr, | 416 | const u8 *addr, |