1 --- a/net/mac80211/agg-rx.c
2 +++ b/net/mac80211/agg-rx.c
3 @@ -176,6 +176,8 @@ static void ieee80211_send_addba_resp(st
4 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
5 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
6 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
7 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
8 + memcpy(mgmt->bssid, da, ETH_ALEN);
10 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
11 IEEE80211_STYPE_ACTION);
12 --- a/net/mac80211/agg-tx.c
13 +++ b/net/mac80211/agg-tx.c
14 @@ -79,7 +79,8 @@ static void ieee80211_send_addba_request
15 memcpy(mgmt->da, da, ETH_ALEN);
16 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
17 if (sdata->vif.type == NL80211_IFTYPE_AP ||
18 - sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
19 + sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
20 + sdata->vif.type == NL80211_IFTYPE_WDS)
21 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
22 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
23 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
24 @@ -398,7 +399,8 @@ int ieee80211_start_tx_ba_session(struct
26 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
27 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
28 - sdata->vif.type != NL80211_IFTYPE_AP)
29 + sdata->vif.type != NL80211_IFTYPE_AP &&
30 + sdata->vif.type != NL80211_IFTYPE_WDS)
33 if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) {
34 --- a/net/mac80211/debugfs_sta.c
35 +++ b/net/mac80211/debugfs_sta.c
36 @@ -59,7 +59,7 @@ static ssize_t sta_flags_read(struct fil
38 struct sta_info *sta = file->private_data;
39 u32 staflags = get_sta_flags(sta);
40 - int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
41 + int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s",
42 staflags & WLAN_STA_AUTH ? "AUTH\n" : "",
43 staflags & WLAN_STA_ASSOC ? "ASSOC\n" : "",
44 staflags & WLAN_STA_PS_STA ? "PS (sta)\n" : "",
45 @@ -67,7 +67,6 @@ static ssize_t sta_flags_read(struct fil
46 staflags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "",
47 staflags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "",
48 staflags & WLAN_STA_WME ? "WME\n" : "",
49 - staflags & WLAN_STA_WDS ? "WDS\n" : "",
50 staflags & WLAN_STA_MFP ? "MFP\n" : "");
51 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
53 --- a/net/mac80211/iface.c
54 +++ b/net/mac80211/iface.c
55 @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
57 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
58 struct ieee80211_local *local = sdata->local;
59 - struct sta_info *sta;
62 u32 hw_reconf_flags = 0;
63 @@ -290,27 +289,6 @@ static int ieee80211_do_open(struct net_
65 set_bit(SDATA_STATE_RUNNING, &sdata->state);
67 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
68 - /* Create STA entry for the WDS peer */
69 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
73 - goto err_del_interface;
76 - /* no locking required since STA is not live yet */
77 - sta->flags |= WLAN_STA_AUTHORIZED;
79 - res = sta_info_insert(sta);
81 - /* STA has been freed */
82 - goto err_del_interface;
85 - rate_control_rate_init(sta);
89 * set_multicast_list will be invoked by the networking core
90 * which will check whether any increments here were done in
91 @@ -344,8 +322,7 @@ static int ieee80211_do_open(struct net_
92 netif_tx_start_all_queues(dev);
96 - drv_remove_interface(local, &sdata->vif);
99 if (!local->open_count)
101 @@ -718,6 +695,70 @@ static void ieee80211_if_setup(struct ne
102 dev->destructor = free_netdev;
105 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
106 + struct sk_buff *skb)
108 + struct ieee80211_local *local = sdata->local;
109 + struct ieee80211_rx_status *rx_status;
110 + struct ieee802_11_elems elems;
111 + struct ieee80211_mgmt *mgmt;
112 + struct sta_info *sta;
117 + enum ieee80211_band band = local->hw.conf.channel->band;
118 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
120 + rx_status = IEEE80211_SKB_RXCB(skb);
121 + mgmt = (struct ieee80211_mgmt *) skb->data;
122 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
124 + if (stype != IEEE80211_STYPE_BEACON)
127 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
128 + if (baselen > skb->len)
131 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
132 + skb->len - baselen, &elems);
134 + rates = ieee80211_sta_get_rates(local, &elems, band);
138 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
142 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
150 + sta->last_rx = jiffies;
151 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
153 + if (elems.ht_cap_elem)
154 + ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
155 + elems.ht_cap_elem, &sta->sta.ht_cap);
157 + if (elems.wmm_param)
158 + set_sta_flags(sta, WLAN_STA_WME);
161 + sta->flags = WLAN_STA_AUTHORIZED;
162 + rate_control_rate_init(sta);
163 + sta_info_insert_rcu(sta);
169 static void ieee80211_iface_work(struct work_struct *work)
171 struct ieee80211_sub_if_data *sdata =
172 @@ -822,6 +863,9 @@ static void ieee80211_iface_work(struct
174 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
176 + case NL80211_IFTYPE_WDS:
177 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
180 WARN(1, "frame for unexpected interface type");
182 --- a/net/mac80211/rx.c
183 +++ b/net/mac80211/rx.c
184 @@ -2137,7 +2137,8 @@ ieee80211_rx_h_action(struct ieee80211_r
186 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
187 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
188 - sdata->vif.type != NL80211_IFTYPE_AP)
189 + sdata->vif.type != NL80211_IFTYPE_AP &&
190 + sdata->vif.type != NL80211_IFTYPE_WDS)
193 /* verify action_code is present */
194 @@ -2335,13 +2336,14 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
196 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
197 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
198 - sdata->vif.type != NL80211_IFTYPE_STATION)
199 + sdata->vif.type != NL80211_IFTYPE_STATION &&
200 + sdata->vif.type != NL80211_IFTYPE_WDS)
201 return RX_DROP_MONITOR;
204 case cpu_to_le16(IEEE80211_STYPE_BEACON):
205 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
206 - /* process for all: mesh, mlme, ibss */
207 + /* process for all: mesh, mlme, ibss, wds */
209 case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
210 case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
211 @@ -2680,10 +2682,16 @@ static int prepare_for_handlers(struct i
214 case NL80211_IFTYPE_WDS:
215 - if (bssid || !ieee80211_is_data(hdr->frame_control))
217 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
220 + if (ieee80211_is_data(hdr->frame_control) ||
221 + ieee80211_is_action(hdr->frame_control)) {
222 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
224 + } else if (!ieee80211_is_beacon(hdr->frame_control))
229 /* should never get here */
230 --- a/net/mac80211/sta_info.h
231 +++ b/net/mac80211/sta_info.h
234 * @WLAN_STA_ASSOC_AP: We're associated to that station, it is an AP.
235 * @WLAN_STA_WME: Station is a QoS-STA.
236 - * @WLAN_STA_WDS: Station is one of our WDS peers.
237 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
238 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
239 * frame to this station is transmitted.
240 @@ -54,7 +53,6 @@ enum ieee80211_sta_info_flags {
241 WLAN_STA_SHORT_PREAMBLE = 1<<4,
242 WLAN_STA_ASSOC_AP = 1<<5,
244 - WLAN_STA_WDS = 1<<7,
245 WLAN_STA_CLEAR_PS_FILT = 1<<9,
246 WLAN_STA_MFP = 1<<10,
247 WLAN_STA_BLOCK_BA = 1<<11,