ad15ca97469c10c2133d02d05360280aade98149
[openwrt-10.03/.git] / package / mac80211 / patches / 550-vlan_sta_lookup.patch
1 --- a/net/mac80211/sta_info.c
2 +++ b/net/mac80211/sta_info.c
3 @@ -119,6 +119,27 @@ struct sta_info *sta_info_get(struct iee
4         return sta;
5  }
6  
7 +/*
8 + * Get sta info either from the specified interface
9 + * or from one of its vlans
10 + */
11 +struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
12 +                                 const u8 *addr)
13 +{
14 +       struct ieee80211_local *local = sdata->local;
15 +       struct sta_info *sta;
16 +
17 +       sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
18 +       while (sta) {
19 +               if ((sta->sdata == sdata ||
20 +                    sta->sdata->bss == sdata->bss) &&
21 +                   memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
22 +                       break;
23 +               sta = rcu_dereference(sta->hnext);
24 +       }
25 +       return sta;
26 +}
27 +
28  struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
29                                      int idx)
30  {
31 --- a/net/mac80211/sta_info.h
32 +++ b/net/mac80211/sta_info.h
33 @@ -408,6 +408,9 @@ static inline u32 get_sta_flags(struct s
34  struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
35                               const u8 *addr);
36  
37 +struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
38 +                                 const u8 *addr);
39 +
40  static inline
41  void for_each_sta_info_type_check(struct ieee80211_local *local,
42                                   const u8 *addr,
43 --- a/net/mac80211/cfg.c
44 +++ b/net/mac80211/cfg.c
45 @@ -148,7 +148,7 @@ static int ieee80211_add_key(struct wiph
46         rcu_read_lock();
47  
48         if (mac_addr) {
49 -               sta = sta_info_get(sdata, mac_addr);
50 +               sta = sta_info_get_bss(sdata, mac_addr);
51                 if (!sta) {
52                         ieee80211_key_free(key);
53                         err = -ENOENT;
54 @@ -179,7 +179,7 @@ static int ieee80211_del_key(struct wiph
55         if (mac_addr) {
56                 ret = -ENOENT;
57  
58 -               sta = sta_info_get(sdata, mac_addr);
59 +               sta = sta_info_get_bss(sdata, mac_addr);
60                 if (!sta)
61                         goto out_unlock;
62  
63 @@ -226,7 +226,7 @@ static int ieee80211_get_key(struct wiph
64         rcu_read_lock();
65  
66         if (mac_addr) {
67 -               sta = sta_info_get(sdata, mac_addr);
68 +               sta = sta_info_get_bss(sdata, mac_addr);
69                 if (!sta)
70                         goto out;
71  
72 @@ -419,7 +419,7 @@ static int ieee80211_get_station(struct 
73  
74         rcu_read_lock();
75  
76 -       sta = sta_info_get(sdata, mac);
77 +       sta = sta_info_get_bss(sdata, mac);
78         if (sta) {
79                 ret = 0;
80                 sta_set_sinfo(sta, sinfo);
81 @@ -775,7 +775,7 @@ static int ieee80211_del_station(struct 
82         if (mac) {
83                 rcu_read_lock();
84  
85 -               sta = sta_info_get(sdata, mac);
86 +               sta = sta_info_get_bss(sdata, mac);
87                 if (!sta) {
88                         rcu_read_unlock();
89                         return -ENOENT;
90 @@ -803,7 +803,7 @@ static int ieee80211_change_station(stru
91  
92         rcu_read_lock();
93  
94 -       sta = sta_info_get(sdata, mac);
95 +       sta = sta_info_get_bss(sdata, mac);
96         if (!sta) {
97                 rcu_read_unlock();
98                 return -ENOENT;