package uuidgen
[openwrt.git] / package / mac80211 / patches / 010-add-mgmt-iface.patch
1 ---
2 include/net/mac80211.h | 1
3 net/mac80211/ieee80211.c | 198 ++++++++++++++++++++++++++++++++++++++--
4 net/mac80211/ieee80211_common.h | 64 ++++++++++++
5 net/mac80211/ieee80211_i.h | 9 +
6 net/mac80211/ieee80211_iface.c | 66 +++++++++++++
7 net/mac80211/ieee80211_ioctl.c | 21 ++++
8 net/mac80211/ieee80211_rate.c | 3
9 net/mac80211/ieee80211_rate.h | 2
10 net/mac80211/ieee80211_sta.c | 2
11 net/mac80211/rx.c | 29 ++++-
12 net/mac80211/tx.c | 14 ++
13 net/mac80211/wme.c | 10 +-
14 12 files changed, 399 insertions(+), 20 deletions(-)
15
16 Index: mac80211/include/net/mac80211.h
17 ===================================================================
18 --- mac80211.orig/include/net/mac80211.h 2007-11-11 15:15:42.824034853 +0100
19 +++ mac80211/include/net/mac80211.h 2007-11-11 15:15:53.784659457 +0100
20 @@ -472,6 +472,7 @@
21 enum ieee80211_if_types {
22 IEEE80211_IF_TYPE_INVALID,
23 IEEE80211_IF_TYPE_AP,
24 + IEEE80211_IF_TYPE_MGMT,
25 IEEE80211_IF_TYPE_STA,
26 IEEE80211_IF_TYPE_IBSS,
27 IEEE80211_IF_TYPE_MNTR,
28 Index: mac80211/net/mac80211/ieee80211.c
29 ===================================================================
30 --- mac80211.orig/net/mac80211/ieee80211.c 2007-11-11 15:15:51.536531354 +0100
31 +++ mac80211/net/mac80211/ieee80211.c 2007-11-11 15:16:22.214279577 +0100
32 @@ -23,6 +23,7 @@
33 #include <linux/bitmap.h>
34 #include <net/cfg80211.h>
35
36 +#include "ieee80211_common.h"
37 #include "ieee80211_i.h"
38 #include "ieee80211_rate.h"
39 #include "wep.h"
40 @@ -121,6 +122,152 @@
41 ieee80211_configure_filter(local);
42 }
43
44 +/* management interface */
45 +
46 +static void
47 +ieee80211_fill_frame_info(struct ieee80211_local *local,
48 + struct ieee80211_frame_info *fi,
49 + struct ieee80211_rx_status *status)
50 +{
51 + if (status) {
52 + struct timespec ts;
53 + struct ieee80211_rate *rate;
54 +
55 + jiffies_to_timespec(jiffies, &ts);
56 + fi->hosttime = cpu_to_be64((u64) ts.tv_sec * 1000000 +
57 + ts.tv_nsec / 1000);
58 + fi->mactime = cpu_to_be64(status->mactime);
59 + switch (status->phymode) {
60 + case MODE_IEEE80211A:
61 + fi->phytype = htonl(ieee80211_phytype_ofdm_dot11_a);
62 + break;
63 + case MODE_IEEE80211B:
64 + fi->phytype = htonl(ieee80211_phytype_dsss_dot11_b);
65 + break;
66 + case MODE_IEEE80211G:
67 + fi->phytype = htonl(ieee80211_phytype_pbcc_dot11_g);
68 + break;
69 + default:
70 + fi->phytype = htonl(0xAAAAAAAA);
71 + break;
72 + }
73 + fi->channel = htonl(status->channel);
74 + rate = ieee80211_get_rate(local, status->phymode,
75 + status->rate);
76 + if (rate) {
77 + fi->datarate = htonl(rate->rate);
78 + if (rate->flags & IEEE80211_RATE_PREAMBLE2) {
79 + if (status->rate == rate->val)
80 + fi->preamble = htonl(2); /* long */
81 + else if (status->rate == rate->val2)
82 + fi->preamble = htonl(1); /* short */
83 + } else
84 + fi->preamble = htonl(0);
85 + } else {
86 + fi->datarate = htonl(0);
87 + fi->preamble = htonl(0);
88 + }
89 +
90 + fi->antenna = htonl(status->antenna);
91 + fi->priority = htonl(0xffffffff); /* no clue */
92 + fi->ssi_type = htonl(ieee80211_ssi_raw);
93 + fi->ssi_signal = htonl(status->ssi);
94 + fi->ssi_noise = 0x00000000;
95 + fi->encoding = 0;
96 + } else {
97 + /* clear everything because we really don't know.
98 + * the msg_type field isn't present on monitor frames
99 + * so we don't know whether it will be present or not,
100 + * but it's ok to not clear it since it'll be assigned
101 + * anyway */
102 + memset(fi, 0, sizeof(*fi) - sizeof(fi->msg_type));
103 +
104 + fi->ssi_type = htonl(ieee80211_ssi_none);
105 + }
106 + fi->version = htonl(IEEE80211_FI_VERSION);
107 + fi->length = cpu_to_be32(sizeof(*fi) - sizeof(fi->msg_type));
108 +}
109 +
110 +/* this routine is actually not just for this, but also
111 + * for pushing fake 'management' frames into userspace.
112 + * it shall be replaced by a netlink-based system. */
113 +void
114 +ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
115 + struct ieee80211_rx_status *status, u32 msg_type)
116 +{
117 + struct ieee80211_frame_info *fi;
118 + const size_t hlen = sizeof(struct ieee80211_frame_info);
119 + struct net_device *dev = local->apdev;
120 +
121 + skb->dev = dev;
122 +
123 + if (skb_headroom(skb) < hlen) {
124 + I802_DEBUG_INC(local->rx_expand_skb_head);
125 + if (pskb_expand_head(skb, hlen, 0, GFP_ATOMIC)) {
126 + dev_kfree_skb(skb);
127 + return;
128 + }
129 + }
130 +
131 + fi = (struct ieee80211_frame_info *) skb_push(skb, hlen);
132 +
133 + ieee80211_fill_frame_info(local, fi, status);
134 + fi->msg_type = htonl(msg_type);
135 +
136 + dev->stats.rx_packets++;
137 + dev->stats.rx_bytes += skb->len;
138 +
139 + skb_set_mac_header(skb, 0);
140 + skb->ip_summed = CHECKSUM_UNNECESSARY;
141 + skb->pkt_type = PACKET_OTHERHOST;
142 + skb->protocol = htons(ETH_P_802_2);
143 + memset(skb->cb, 0, sizeof(skb->cb));
144 + netif_rx(skb);
145 +}
146 +
147 +static int ieee80211_mgmt_open(struct net_device *dev)
148 +{
149 + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
150 +
151 + if (!netif_running(local->mdev))
152 + return -EOPNOTSUPP;
153 + return 0;
154 +}
155 +
156 +static int ieee80211_mgmt_stop(struct net_device *dev)
157 +{
158 + return 0;
159 +}
160 +
161 +static int ieee80211_change_mtu_apdev(struct net_device *dev, int new_mtu)
162 +{
163 + /* FIX: what would be proper limits for MTU?
164 + * This interface uses 802.11 frames. */
165 + if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN) {
166 + printk(KERN_WARNING "%s: invalid MTU %d\n",
167 + dev->name, new_mtu);
168 + return -EINVAL;
169 + }
170 +
171 +#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
172 + printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu);
173 +#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
174 + dev->mtu = new_mtu;
175 + return 0;
176 +}
177 +
178 +void ieee80211_if_mgmt_setup(struct net_device *dev)
179 +{
180 + ether_setup(dev);
181 + dev->hard_start_xmit = ieee80211_mgmt_start_xmit;
182 + dev->change_mtu = ieee80211_change_mtu_apdev;
183 + dev->open = ieee80211_mgmt_open;
184 + dev->stop = ieee80211_mgmt_stop;
185 + dev->type = ARPHRD_IEEE80211_PRISM;
186 + dev->hard_header_parse = &header_parse_80211;
187 + dev->destructor = ieee80211_if_free;
188 +}
189 +
190 /* regular interfaces */
191
192 static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
193 @@ -198,6 +345,7 @@
194 return -ENOLINK;
195 break;
196 case IEEE80211_IF_TYPE_AP:
197 + case IEEE80211_IF_TYPE_MGMT:
198 case IEEE80211_IF_TYPE_STA:
199 case IEEE80211_IF_TYPE_MNTR:
200 case IEEE80211_IF_TYPE_IBSS:
201 @@ -262,6 +410,10 @@
202 if (local->open_count == 0) {
203 res = dev_open(local->mdev);
204 WARN_ON(res);
205 + if (local->apdev) {
206 + res = dev_open(local->apdev);
207 + WARN_ON(res);
208 + }
209 tasklet_enable(&local->tx_pending_tasklet);
210 tasklet_enable(&local->tasklet);
211 }
212 @@ -347,6 +499,9 @@
213 if (netif_running(local->mdev))
214 dev_close(local->mdev);
215
216 + if (local->apdev)
217 + dev_close(local->apdev);
218 +
219 if (local->ops->stop)
220 local->ops->stop(local_to_hw(local));
221
222 @@ -646,6 +801,8 @@
223 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
224 if (control->flags & IEEE80211_TXCTL_REQUEUE)
225 pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
226 + if (control->type == IEEE80211_IF_TYPE_MGMT)
227 + pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
228 pkt_data->queue = control->queue;
229
230 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
231 @@ -698,6 +855,7 @@
232 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
233 struct ieee80211_local *local = hw_to_local(hw);
234 u16 frag, type;
235 + u32 msg_type;
236 struct ieee80211_tx_status_rtap_hdr *rthdr;
237 struct ieee80211_sub_if_data *sdata;
238 int monitors;
239 @@ -812,9 +970,29 @@
240 local->dot11FailedCount++;
241 }
242
243 + msg_type = (status->flags & IEEE80211_TX_STATUS_ACK) ?
244 + ieee80211_msg_tx_callback_ack : ieee80211_msg_tx_callback_fail;
245 +
246 /* this was a transmitted frame, but now we want to reuse it */
247 skb_orphan(skb);
248
249 + if ((status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS) &&
250 + local->apdev) {
251 + if (local->monitors) {
252 + skb2 = skb_clone(skb, GFP_ATOMIC);
253 + } else {
254 + skb2 = skb;
255 + skb = NULL;
256 + }
257 +
258 + if (skb2)
259 + /* Send frame to hostapd */
260 + ieee80211_rx_mgmt(local, skb2, NULL, msg_type);
261 +
262 + if (!skb)
263 + return;
264 + }
265 +
266 if (!local->monitors) {
267 dev_kfree_skb(skb);
268 return;
269 @@ -1161,6 +1339,8 @@
270 BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED);
271
272 local->reg_state = IEEE80211_DEV_UNREGISTERED;
273 + if (local->apdev)
274 + ieee80211_if_del_mgmt(local);
275
276 /*
277 * At this point, interface list manipulations are fine
278 Index: mac80211/net/mac80211/ieee80211_i.h
279 ===================================================================
280 --- mac80211.orig/net/mac80211/ieee80211_i.h 2007-11-11 15:15:42.840035769 +0100
281 +++ mac80211/net/mac80211/ieee80211_i.h 2007-11-11 15:15:53.792659922 +0100
282 @@ -142,6 +142,7 @@
283 * when using CTS protection with IEEE 802.11g. */
284 struct ieee80211_rate *last_frag_rate;
285 int last_frag_hwrate;
286 + int mgmt_interface;
287
288 /* Extra fragments (in addition to the first fragment
289 * in skb) */
290 @@ -163,6 +164,7 @@
291 #define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
292 #define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
293 #define IEEE80211_TXPD_REQUEUE BIT(2)
294 +#define IEEE80211_TXPD_MGMT_IFACE BIT(3)
295 /* Stored in sk_buff->cb */
296 struct ieee80211_tx_packet_data {
297 int ifindex;
298 @@ -408,6 +410,7 @@
299 struct list_head modes_list;
300
301 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
302 + struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
303 int open_count;
304 int monitors;
305 unsigned int filter_flags; /* FIF_* */
306 @@ -701,11 +704,14 @@
307 int ieee80211_hw_config(struct ieee80211_local *local);
308 int ieee80211_if_config(struct net_device *dev);
309 int ieee80211_if_config_beacon(struct net_device *dev);
310 +void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
311 + struct ieee80211_rx_status *status, u32 msg_type);
312 void ieee80211_prepare_rates(struct ieee80211_local *local,
313 struct ieee80211_hw_mode *mode);
314 void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
315 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
316 void ieee80211_if_setup(struct net_device *dev);
317 +void ieee80211_if_mgmt_setup(struct net_device *dev);
318 struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
319 int phymode, int hwrate);
320
321 @@ -772,6 +778,8 @@
322 int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
323 void ieee80211_if_free(struct net_device *dev);
324 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
325 +int ieee80211_if_add_mgmt(struct ieee80211_local *local);
326 +void ieee80211_if_del_mgmt(struct ieee80211_local *local);
327
328 /* regdomain.c */
329 void ieee80211_regdomain_init(void);
330 @@ -788,6 +796,7 @@
331 int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
332 int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
333 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
334 +int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
335
336 /* utility functions/constants */
337 extern void *mac80211_wiphy_privid; /* for wiphy privid */
338 Index: mac80211/net/mac80211/ieee80211_iface.c
339 ===================================================================
340 --- mac80211.orig/net/mac80211/ieee80211_iface.c 2007-11-11 15:15:42.848036222 +0100
341 +++ mac80211/net/mac80211/ieee80211_iface.c 2007-11-11 15:15:53.796660158 +0100
342 @@ -96,6 +96,66 @@
343 return ret;
344 }
345
346 +int ieee80211_if_add_mgmt(struct ieee80211_local *local)
347 +{
348 + struct net_device *ndev;
349 + struct ieee80211_sub_if_data *nsdata;
350 + int ret;
351 +
352 + ASSERT_RTNL();
353 +
354 + ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), "wmgmt%d",
355 + ieee80211_if_mgmt_setup);
356 + if (!ndev)
357 + return -ENOMEM;
358 + ret = dev_alloc_name(ndev, ndev->name);
359 + if (ret < 0)
360 + goto fail;
361 +
362 + memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
363 + SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
364 +
365 + nsdata = IEEE80211_DEV_TO_SUB_IF(ndev);
366 + ndev->ieee80211_ptr = &nsdata->wdev;
367 + nsdata->wdev.wiphy = local->hw.wiphy;
368 + nsdata->type = IEEE80211_IF_TYPE_MGMT;
369 + nsdata->dev = ndev;
370 + nsdata->local = local;
371 + ieee80211_if_sdata_init(nsdata);
372 +
373 + ret = register_netdevice(ndev);
374 + if (ret)
375 + goto fail;
376 +
377 + /*
378 + * Called even when register_netdevice fails, it would
379 + * oops if assigned before initialising the rest.
380 + */
381 + ndev->uninit = ieee80211_if_reinit;
382 +
383 + ieee80211_debugfs_add_netdev(nsdata);
384 +
385 + if (local->open_count > 0)
386 + dev_open(ndev);
387 + local->apdev = ndev;
388 + return 0;
389 +
390 +fail:
391 + free_netdev(ndev);
392 + return ret;
393 +}
394 +
395 +void ieee80211_if_del_mgmt(struct ieee80211_local *local)
396 +{
397 + struct net_device *apdev;
398 +
399 + ASSERT_RTNL();
400 + apdev = local->apdev;
401 + ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(apdev));
402 + local->apdev = NULL;
403 + unregister_netdevice(apdev);
404 +}
405 +
406 void ieee80211_if_set_type(struct net_device *dev, int type)
407 {
408 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
409 @@ -183,6 +243,9 @@
410 ieee80211_if_sdata_deinit(sdata);
411
412 switch (sdata->type) {
413 + case IEEE80211_IF_TYPE_MGMT:
414 + /* nothing to do */
415 + break;
416 case IEEE80211_IF_TYPE_INVALID:
417 /* cannot happen */
418 WARN_ON(1);
419 @@ -294,8 +357,11 @@
420
421 void ieee80211_if_free(struct net_device *dev)
422 {
423 + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
424 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
425
426 + /* local->apdev must be NULL when freeing management interface */
427 + BUG_ON(dev == local->apdev);
428 ieee80211_if_sdata_deinit(sdata);
429 free_netdev(dev);
430 }
431 Index: mac80211/net/mac80211/ieee80211_rate.c
432 ===================================================================
433 --- mac80211.orig/net/mac80211/ieee80211_rate.c 2007-11-11 15:15:42.852036451 +0100
434 +++ mac80211/net/mac80211/ieee80211_rate.c 2007-11-11 15:15:53.800660386 +0100
435 @@ -145,7 +145,8 @@
436 struct rate_control_ref *ref, *old;
437
438 ASSERT_RTNL();
439 - if (local->open_count || netif_running(local->mdev))
440 + if (local->open_count || netif_running(local->mdev) ||
441 + (local->apdev && netif_running(local->apdev)))
442 return -EBUSY;
443
444 ref = rate_control_alloc(name, local);
445 Index: mac80211/net/mac80211/ieee80211_rate.h
446 ===================================================================
447 --- mac80211.orig/net/mac80211/ieee80211_rate.h 2007-11-11 15:15:42.860036908 +0100
448 +++ mac80211/net/mac80211/ieee80211_rate.h 2007-11-11 15:15:53.800660386 +0100
449 @@ -30,6 +30,8 @@
450
451 /* parameters from the caller to rate_control_get_rate(): */
452 struct ieee80211_hw_mode *mode;
453 + int mgmt_data; /* this is data frame that is used for management
454 + * (e.g., IEEE 802.1X EAPOL) */
455 u16 ethertype;
456 };
457
458 Index: mac80211/net/mac80211/ieee80211_sta.c
459 ===================================================================
460 --- mac80211.orig/net/mac80211/ieee80211_sta.c 2007-11-11 15:15:42.868037362 +0100
461 +++ mac80211/net/mac80211/ieee80211_sta.c 2007-11-11 15:15:53.800660386 +0100
462 @@ -475,6 +475,8 @@
463 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
464 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
465 pkt_data->ifindex = sdata->dev->ifindex;
466 + if (sdata->type == IEEE80211_IF_TYPE_MGMT)
467 + pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
468 if (!encrypt)
469 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
470
471 Index: mac80211/net/mac80211/rx.c
472 ===================================================================
473 --- mac80211.orig/net/mac80211/rx.c 2007-11-11 15:15:42.872037591 +0100
474 +++ mac80211/net/mac80211/rx.c 2007-11-11 15:15:53.804660611 +0100
475 @@ -19,6 +19,7 @@
476
477 #include "ieee80211_i.h"
478 #include "ieee80211_led.h"
479 +#include "ieee80211_common.h"
480 #include "wep.h"
481 #include "wpa.h"
482 #include "tkip.h"
483 @@ -411,7 +412,12 @@
484 return TXRX_DROP;
485 }
486
487 - return TXRX_DROP;
488 + if (!rx->local->apdev)
489 + return TXRX_DROP;
490 +
491 + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
492 + ieee80211_msg_sta_not_assoc);
493 + return TXRX_QUEUED;
494 }
495
496 return TXRX_CONTINUE;
497 @@ -953,8 +959,15 @@
498 {
499 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
500 rx->sdata->type != IEEE80211_IF_TYPE_STA &&
501 - (rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
502 - return TXRX_CONTINUE;
503 + (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
504 + /* Pass both encrypted and unencrypted EAPOL frames to user
505 + * space for processing. */
506 + if (!rx->local->apdev)
507 + return TXRX_DROP;
508 + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
509 + ieee80211_msg_normal);
510 + return TXRX_QUEUED;
511 + }
512
513 if (unlikely(rx->sdata->ieee802_1x &&
514 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
515 @@ -1196,8 +1209,13 @@
516 sdata->type == IEEE80211_IF_TYPE_IBSS) &&
517 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME))
518 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status);
519 - else
520 - return TXRX_DROP;
521 + else {
522 + /* Management frames are sent to hostapd for processing */
523 + if (!rx->local->apdev)
524 + return TXRX_DROP;
525 + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
526 + ieee80211_msg_normal);
527 + }
528
529 return TXRX_QUEUED;
530 }
531 @@ -1407,6 +1425,7 @@
532 /* take everything */
533 break;
534 case IEEE80211_IF_TYPE_INVALID:
535 + case IEEE80211_IF_TYPE_MGMT:
536 /* should never get here */
537 WARN_ON(1);
538 break;
539 Index: mac80211/net/mac80211/tx.c
540 ===================================================================
541 --- mac80211.orig/net/mac80211/tx.c 2007-11-11 15:15:42.880038048 +0100
542 +++ mac80211/net/mac80211/tx.c 2007-11-11 15:15:53.804660611 +0100
543 @@ -258,7 +258,7 @@
544 return TXRX_CONTINUE;
545 }
546
547 - if (unlikely(/* !injected && */ tx->sdata->ieee802_1x &&
548 + if (unlikely(!tx->u.tx.mgmt_interface && tx->sdata->ieee802_1x &&
549 !(sta_flags & WLAN_STA_AUTHORIZED))) {
550 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
551 printk(KERN_DEBUG "%s: dropped frame to " MAC_FMT
552 @@ -568,6 +568,8 @@
553 memset(&extra, 0, sizeof(extra));
554 extra.mode = tx->u.tx.mode;
555 extra.ethertype = tx->ethertype;
556 + extra.mgmt_data = tx->sdata &&
557 + tx->sdata->type == IEEE80211_IF_TYPE_MGMT;
558
559 tx->u.tx.rate = rate_control_get_rate(tx->local, tx->dev,
560 tx->skb, &extra);
561 @@ -1076,7 +1078,7 @@
562 }
563
564 static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
565 - struct ieee80211_tx_control *control)
566 + struct ieee80211_tx_control *control, int mgmt)
567 {
568 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
569 struct sta_info *sta;
570 @@ -1107,6 +1109,7 @@
571 rcu_read_lock();
572
573 sta = tx.sta;
574 + tx.u.tx.mgmt_interface = mgmt;
575 tx.u.tx.mode = local->hw.conf.mode;
576
577 for (handler = local->tx_handlers; *handler != NULL;
578 @@ -1253,7 +1256,8 @@
579 control.flags |= IEEE80211_TXCTL_REQUEUE;
580 control.queue = pkt_data->queue;
581
582 - ret = ieee80211_tx(odev, skb, &control);
583 + ret = ieee80211_tx(odev, skb, &control,
584 + control.type == IEEE80211_IF_TYPE_MGMT);
585 dev_put(odev);
586
587 return ret;
588 @@ -1498,6 +1502,8 @@
589 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
590 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
591 pkt_data->ifindex = dev->ifindex;
592 + if (sdata->type == IEEE80211_IF_TYPE_MGMT)
593 + pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
594
595 skb->dev = local->mdev;
596 dev->stats.tx_packets++;
597 @@ -1555,6 +1561,8 @@
598 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
599 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
600 pkt_data->ifindex = sdata->dev->ifindex;
601 + if (sdata->type == IEEE80211_IF_TYPE_MGMT)
602 + pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
603
604 skb->priority = 20; /* use hardcoded priority for mgmt TX queue */
605 skb->dev = sdata->local->mdev;
606 Index: mac80211/net/mac80211/wme.c
607 ===================================================================
608 --- mac80211.orig/net/mac80211/wme.c 2007-11-11 15:15:42.888038502 +0100
609 +++ mac80211/net/mac80211/wme.c 2007-11-11 15:15:53.804660611 +0100
610 @@ -94,6 +94,8 @@
611 static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
612 {
613 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
614 + struct ieee80211_tx_packet_data *pkt_data =
615 + (struct ieee80211_tx_packet_data *) skb->cb;
616 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
617 unsigned short fc = le16_to_cpu(hdr->frame_control);
618 int qos;
619 @@ -106,8 +108,12 @@
620 return IEEE80211_TX_QUEUE_DATA0;
621 }
622
623 - if (0 /* injected */) {
624 - /* use AC from radiotap */
625 + if (unlikely(pkt_data->flags & IEEE80211_TXPD_MGMT_IFACE)) {
626 + /* Data frames from hostapd (mainly, EAPOL) use AC_VO
627 + * and they will include QoS control fields if
628 + * the target STA is using WME. */
629 + skb->priority = 7;
630 + return ieee802_1d_to_ac[skb->priority];
631 }
632
633 /* is this a QoS frame? */
634 Index: mac80211/net/mac80211/ieee80211_ioctl.c
635 ===================================================================
636 --- mac80211.orig/net/mac80211/ieee80211_ioctl.c 2007-11-11 15:15:51.532531127 +0100
637 +++ mac80211/net/mac80211/ieee80211_ioctl.c 2007-11-11 15:15:53.808660833 +0100
638 @@ -840,16 +840,29 @@
639 void *wrqu, char *extra)
640 {
641 struct ieee80211_sub_if_data *sdata;
642 + struct ieee80211_local *local;
643 int *i = (int *) extra;
644 int param = *i;
645 + int value = *(i + 1);
646 int ret = 0;
647
648 if (!capable(CAP_NET_ADMIN))
649 return -EPERM;
650
651 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
652 + local = sdata->local;
653
654 switch (param) {
655 + case PRISM2_PARAM_MGMT_IF:
656 + if (value == 1) {
657 + if (!local->apdev)
658 + ret = ieee80211_if_add_mgmt(local);
659 + } else if (value == 0) {
660 + if (local->apdev)
661 + ieee80211_if_del_mgmt(local);
662 + } else
663 + ret = -EINVAL;
664 + break;
665 default:
666 ret = -EOPNOTSUPP;
667 break;
668 @@ -864,12 +877,20 @@
669 void *wrqu, char *extra)
670 {
671 struct ieee80211_sub_if_data *sdata;
672 + struct ieee80211_local *local;
673 int *param = (int *) extra;
674 int ret = 0;
675
676 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
677 + local = sdata->local;
678
679 switch (*param) {
680 + case PRISM2_PARAM_MGMT_IF:
681 + if (local->apdev)
682 + *param = local->apdev->ifindex;
683 + else
684 + ret = -ENOENT;
685 + break;
686 default:
687 ret = -EOPNOTSUPP;
688 break;
This page took 0.074383 seconds and 5 git commands to generate.