1 --- a/net80211/ieee80211_input.c
2 +++ b/net80211/ieee80211_input.c
4 struct ieee80211com *ic = vap->iv_ic;
5 struct net_device *dev = vap->iv_dev;
6 struct ieee80211_node *ni_wds = NULL;
7 + struct net_device_stats *stats;
8 struct ieee80211_frame *wh;
9 struct ieee80211_key *key;
10 struct ether_header *eh;
14 case IEEE80211_FC0_TYPE_DATA:
15 - hdrspace = ieee80211_hdrspace(ic, wh);
16 + hdrspace = ieee80211_hdrsize(wh);
17 if (skb->len < hdrspace) {
18 IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
19 wh, "data", "too short: len %u, expecting %u",
22 switch (vap->iv_opmode) {
24 - if ((dir != IEEE80211_FC1_DIR_FROMDS) &&
25 - (!((vap->iv_flags_ext & IEEE80211_FEXT_WDS) &&
26 - (dir == IEEE80211_FC1_DIR_DSTODS)))) {
28 + case IEEE80211_FC1_DIR_FROMDS:
30 + case IEEE80211_FC1_DIR_DSTODS:
31 + if (vap->iv_flags_ext & IEEE80211_FEXT_WDS)
34 IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
35 wh, "data", "invalid dir 0x%x", dir);
36 vap->iv_stats.is_rx_wrongdir++;
40 - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
41 + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
42 + /* ignore 3-addr mcast if we're WDS STA */
43 + if (vap->iv_flags_ext & IEEE80211_FEXT_WDS)
46 /* Discard multicast if IFF_MULTICAST not set */
47 if ((0 != memcmp(wh->i_addr3, dev->broadcast, ETH_ALEN)) &&
48 (0 == (dev->flags & IFF_MULTICAST))) {
50 vap->iv_stats.is_rx_mcastecho++;
54 - * if it is brodcasted by me on behalf of
55 - * a station behind me, drop it.
57 - if (vap->iv_flags_ext & IEEE80211_FEXT_WDS) {
58 - struct ieee80211_node_table *nt;
59 - struct ieee80211_node *ni_wds;
61 - ni_wds = ieee80211_find_wds_node(nt, wh->i_addr3);
63 - ieee80211_unref_node(&ni_wds);
64 - IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
66 - "multicast echo originated from node behind me");
67 - vap->iv_stats.is_rx_mcastecho++;
72 + /* Same BSSID, but not meant for us to receive */
73 + if (!IEEE80211_ADDR_EQ(wh->i_addr1, vap->iv_myaddr))
77 case IEEE80211_M_IBSS:
79 vap->iv_stats.is_rx_notassoc++;
83 + /* subif isn't fully set up yet, drop the frame */
84 + if (ni->ni_subif == ni->ni_vap)
88 * If we're a 4 address packet, make sure we have an entry in
89 * the node table for the packet source address (addr4).
93 /* check for wds link first */
94 - if (dir == IEEE80211_FC1_DIR_DSTODS) {
95 + if ((dir == IEEE80211_FC1_DIR_DSTODS) && !ni->ni_subif) {
96 struct ieee80211vap *avp;
98 + if (vap->iv_flags_ext & IEEE80211_FEXT_WDSSEP) {
99 + ieee80211_wds_addif(ni);
100 + /* we must drop frames here until the interface has
101 + * been fully separated, otherwise a bridge might get
105 TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
106 if (!memcmp(avp->wds_mac, wh->i_addr2, IEEE80211_ADDR_LEN)) {
107 IEEE80211_LOCK_IRQ(ni->ni_ic);
111 /* XXX: Useless node mgmt API; make better */
112 - if ((dir == IEEE80211_FC1_DIR_DSTODS) && !ni_wds) {
113 + if ((dir == IEEE80211_FC1_DIR_DSTODS) && !ni_wds && !ni->ni_subif) {
114 struct ieee80211_node_table *nt = &ic->ic_sta;
115 struct ieee80211_frame_addr4 *wh4;
121 + /* check if there is any data left */
122 + hdrspace = ieee80211_hdrspace(ic, wh);
123 + if (skb->len < hdrspace)
127 * Handle privacy requirements. Note that we
128 * must not be preempted from here until after
130 if (! accept_data_frame(vap, ni, key, skb, eh))
133 - vap->iv_devstats.rx_packets++;
134 - vap->iv_devstats.rx_bytes += skb->len;
135 + if (ni->ni_subif && ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE)))
136 + stats = &ni->ni_subif->iv_devstats;
138 + stats = &vap->iv_devstats;
139 + stats->rx_packets++;
140 + stats->rx_bytes += skb->len;
141 IEEE80211_NODE_STAT(ni, rx_data);
142 IEEE80211_NODE_STAT_ADD(ni, rx_bytes, skb->len);
143 ic->ic_lastdata = jiffies;
144 @@ -1132,6 +1148,13 @@
145 dev = vap->iv_xrvap->iv_dev;
148 + /* if the node has a wds subif, move data frames there,
149 + * but keep EAP traffic on the master */
150 + if (ni->ni_subif && ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE))) {
151 + vap = ni->ni_subif;
155 /* perform as a bridge within the vap */
156 /* XXX intra-vap bridging only */
157 if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
158 @@ -1157,7 +1180,16 @@
160 if (ni1->ni_vap == vap &&
161 ieee80211_node_is_authorized(ni1) &&
163 ni1 != vap->iv_bss) {
165 + /* tried to bridge to a subif, drop the packet */
166 + if (ni->ni_subif) {
167 + ieee80211_unref_node(&ni1);
168 + ieee80211_dev_kfree_skb(&skb);
175 --- a/net80211/ieee80211_ioctl.h
176 +++ b/net80211/ieee80211_ioctl.h
178 IEEE80211_PARAM_BGSCAN_THRESH = 79, /* bg scan rssi threshold */
179 IEEE80211_PARAM_RSSI_DIS_THR = 80, /* rssi threshold for disconnection */
180 IEEE80211_PARAM_RSSI_DIS_COUNT = 81, /* counter for rssi threshold */
181 + IEEE80211_PARAM_WDS_SEP = 82, /* move wds stations into separate interfaces */
184 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
185 --- a/net80211/ieee80211_node.h
186 +++ b/net80211/ieee80211_node.h
188 * the ieee80211com structure.
190 struct ieee80211_node {
191 - struct ieee80211vap *ni_vap;
192 + struct ieee80211vap *ni_vap, *ni_subif;
193 struct ieee80211com *ni_ic;
194 struct ieee80211_node_table *ni_table;
195 TAILQ_ENTRY(ieee80211_node) ni_list;
196 LIST_ENTRY(ieee80211_node) ni_hash;
197 + struct work_struct ni_create; /* task for creating a subif */
198 + struct work_struct ni_destroy; /* task for destroying a subif */
200 u_int ni_scangen; /* gen# for timeout scan */
201 u_int8_t ni_authmode; /* authentication algorithm */
203 void ieee80211_node_leave(struct ieee80211_node *);
204 u_int8_t ieee80211_getrssi(struct ieee80211com *);
205 int32_t ieee80211_get_node_count(struct ieee80211com *);
206 +void ieee80211_wds_addif(struct ieee80211_node *ni);
207 #endif /* _NET80211_IEEE80211_NODE_H_ */
209 --- a/net80211/ieee80211_var.h
210 +++ b/net80211/ieee80211_var.h
212 u_int8_t ic_myaddr[IEEE80211_ADDR_LEN];
213 struct timer_list ic_inact; /* mgmt/inactivity timer */
215 + unsigned int ic_subifs;
216 u_int32_t ic_flags; /* state flags */
217 u_int32_t ic_flags_ext; /* extension of state flags */
218 u_int32_t ic_caps; /* capabilities */
220 #define IEEE80211_FEXT_DROPUNENC_EAPOL 0x00000800 /* CONF: drop unencrypted eapol frames */
221 #define IEEE80211_FEXT_APPIE_UPDATE 0x00001000 /* STATE: beacon APP IE updated */
222 #define IEEE80211_FEXT_BGSCAN_THR 0x00002000 /* bgscan due to low rssi */
223 +#define IEEE80211_FEXT_WDSSEP 0x00004000 /* move wds clients into separate interfaces */
225 #define IEEE80211_COM_UAPSD_ENABLE(_ic) ((_ic)->ic_flags_ext |= IEEE80211_FEXT_UAPSD)
226 #define IEEE80211_COM_UAPSD_DISABLE(_ic) ((_ic)->ic_flags_ext &= ~IEEE80211_FEXT_UAPSD)
227 --- a/net80211/ieee80211_wireless.c
228 +++ b/net80211/ieee80211_wireless.c
229 @@ -2867,6 +2867,14 @@
231 vap->iv_minrateindex = 0;
233 + case IEEE80211_PARAM_WDS_SEP:
234 + if (vap->iv_opmode != IEEE80211_M_HOSTAP)
237 + vap->iv_flags_ext |= IEEE80211_FEXT_WDSSEP;
239 + vap->iv_flags_ext &= ~IEEE80211_FEXT_WDSSEP;
241 #ifdef ATH_REVERSE_ENGINEERING
242 case IEEE80211_PARAM_DUMPREGS:
243 ieee80211_dump_registers(dev, info, w, extra);
244 @@ -3223,6 +3231,9 @@
245 case IEEE80211_PARAM_MINRATE:
246 param[0] = vap->iv_minrateindex;
248 + case IEEE80211_PARAM_WDS_SEP:
249 + param[0] = !!(vap->iv_flags_ext & IEEE80211_FEXT_WDSSEP);
254 @@ -4447,6 +4458,8 @@
255 struct ieee80211vap *vap = ni->ni_vap;
258 + if (req->vap->iv_wdsnode && ni->ni_subif)
259 + vap = ni->ni_subif;
260 if (vap != req->vap && vap != req->vap->iv_xrvap) /* only entries for this vap */
262 if ((vap->iv_opmode == IEEE80211_M_HOSTAP ||
263 @@ -4466,6 +4479,8 @@
267 + if (req->vap->iv_wdsnode && ni->ni_subif)
268 + vap = ni->ni_subif;
269 if (vap != req->vap && vap != req->vap->iv_xrvap) /* only entries for this vap (or) xrvap */
271 if ((vap->iv_opmode == IEEE80211_M_HOSTAP ||
272 @@ -5767,6 +5782,10 @@
273 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
274 { IEEE80211_IOCTL_SETSCANLIST,
275 IW_PRIV_TYPE_CHAR | 255, 0, "setscanlist"},
276 + { IEEE80211_PARAM_WDS_SEP,
277 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wdssep"},
278 + { IEEE80211_PARAM_WDS_SEP,
279 + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_wdssep"},
281 #ifdef ATH_REVERSE_ENGINEERING
283 @@ -5890,6 +5909,8 @@
284 ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
286 struct ieee80211vap *vap = dev->priv;
287 + struct ieee80211com *ic = vap->iv_ic;
288 + struct ieee80211_node *ni;
291 case SIOCG80211STATS:
292 @@ -5898,8 +5919,20 @@
293 case SIOC80211IFDESTROY:
294 if (!capable(CAP_NET_ADMIN))
296 + /* drop all node subifs */
297 + TAILQ_FOREACH(ni, &ic->ic_sta.nt_node, ni_list) {
298 + struct ieee80211vap *avp = ni->ni_subif;
300 + if (ni->ni_vap != vap)
304 + ni->ni_subif = NULL;
305 + ieee80211_stop(avp->iv_dev);
306 + ic->ic_vap_delete(avp);
308 ieee80211_stop(vap->iv_dev); /* force state before cleanup */
309 - vap->iv_ic->ic_vap_delete(vap);
310 + ic->ic_vap_delete(vap);
312 case IEEE80211_IOCTL_GETKEY:
313 return ieee80211_ioctl_getkey(dev, (struct iwreq *) ifr);
314 --- a/net80211/ieee80211_node.c
315 +++ b/net80211/ieee80211_node.c
317 #include <linux/netdevice.h>
318 #include <linux/etherdevice.h>
319 #include <linux/random.h>
320 +#include <linux/rtnetlink.h>
322 #include "if_media.h"
325 ieee80211_node_vdetach(struct ieee80211vap *vap)
327 struct ieee80211com *ic = vap->iv_ic;
328 + struct ieee80211_node *ni;
330 + ni = vap->iv_wdsnode;
332 + ni->ni_subif = NULL;
333 ieee80211_node_table_reset(&ic->ic_sta, vap);
334 if (vap->iv_bss != NULL) {
335 ieee80211_unref_node(&vap->iv_bss);
336 @@ -1134,6 +1139,57 @@
340 +#define WDSIFNAME ".sta%d"
342 +ieee80211_wds_do_addif(struct work_struct *work)
344 + struct ieee80211_node *ni = container_of(work, struct ieee80211_node, ni_create);
345 + struct ieee80211vap *vap = ni->ni_vap;
346 + struct ieee80211com *ic = vap->iv_ic;
347 + struct ieee80211vap *avp;
351 + /* did we get cancelled by the destroy call? */
355 + ni->ni_subif = NULL;
356 + name = kmalloc(strlen(vap->iv_dev->name) + sizeof(WDSIFNAME) + 1, GFP_KERNEL);
360 + strcpy(name, vap->iv_dev->name);
361 + strcat(name, WDSIFNAME);
362 + avp = ieee80211_create_vap(ic, name, ic->ic_dev, IEEE80211_M_WDS, 0, vap);
367 + memcpy(avp->wds_mac, ni->ni_bssid, IEEE80211_ADDR_LEN);
368 + avp->iv_wdsnode = ieee80211_ref_node(ni);
369 + ni->ni_subif = avp;
374 + ieee80211_unref_node(&ni);
378 +void ieee80211_wds_addif(struct ieee80211_node *ni)
380 + /* check if the node is split out already,
381 + * or if we're in progress of setting up a new interface already */
385 + ieee80211_ref_node(ni);
386 + ni->ni_subif = ni->ni_vap;
387 + IEEE80211_INIT_WORK(&ni->ni_create, ieee80211_wds_do_addif);
388 + schedule_work(&ni->ni_create);
391 /* Add wds address to the node table */
393 #ifdef IEEE80211_DEBUG_REFCNT
394 @@ -2254,6 +2310,36 @@
399 +ieee80211_subif_destroy(struct work_struct *work)
401 + struct ieee80211_node *ni = container_of(work, struct ieee80211_node, ni_destroy);
402 + struct ieee80211vap *vap;
403 + struct ieee80211com *ic;
406 + vap = ni->ni_subif;
408 + /* if addif is waiting for the timer to fire, cancel! */
409 + if (vap == ni->ni_vap) {
410 + ni->ni_subif = NULL;
418 + ni->ni_subif = NULL;
419 + ieee80211_stop(vap->iv_dev);
420 + ic->ic_vap_delete(vap);
424 + ieee80211_unref_node(&ni);
429 * Handle bookkeeping for a station/neighbor leaving
430 * the bss when operating in ap or adhoc modes.
431 @@ -2270,6 +2356,12 @@
432 ni, "station with aid %d leaves (refcnt %u)",
433 IEEE80211_NODE_AID(ni), atomic_read(&ni->ni_refcnt));
435 + if (ni->ni_subif) {
436 + ieee80211_ref_node(ni);
437 + IEEE80211_INIT_WORK(&ni->ni_destroy, ieee80211_subif_destroy);
438 + schedule_work(&ni->ni_destroy);
441 /* From this point onwards we can no longer find the node,
442 * so no more references are generated
444 --- a/net80211/ieee80211_linux.h
445 +++ b/net80211/ieee80211_linux.h
450 +#ifndef container_of
451 +#define container_of(ptr, type, member) ({ \
452 + const typeof( ((type *)0)->member ) *__mptr = (ptr); \
453 + (type *)( (char *)__mptr - offsetof(type,member) );})
461 #define IEEE80211_RESCHEDULE schedule
463 +#include <linux/sched.h>
464 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
465 +#include <linux/tqueue.h>
466 +#define work_struct tq_struct
467 +#define schedule_work(t) schedule_task((t))
468 +#define flush_scheduled_work() flush_scheduled_tasks()
469 +#define IEEE80211_INIT_WORK(t, f) do { \
470 + memset((t), 0, sizeof(struct tq_struct)); \
471 + (t)->routine = (void (*)(void*)) (f); \
472 + (t)->data=(void *) (t); \
475 +#include <linux/workqueue.h>
477 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
478 +#define IEEE80211_INIT_WORK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f), (_t));
480 +#define IEEE80211_INIT_WORK(_t, _f) INIT_WORK((_t), (_f));
483 +#endif /* KERNEL_VERSION < 2.5.41 */
487 /* NB: beware, spin_is_locked() is not usefully defined for !(DEBUG || SMP)
488 * because spinlocks do not exist in this configuration. Instead IRQs
489 --- a/net80211/ieee80211_proto.c
490 +++ b/net80211/ieee80211_proto.c
491 @@ -1081,6 +1081,8 @@
493 ieee80211_open(struct net_device *dev)
495 + struct ieee80211vap *vap = dev->priv;
497 return ieee80211_init(dev, 0);
500 @@ -1116,11 +1118,33 @@
501 struct ieee80211vap *vap = dev->priv;
502 struct ieee80211com *ic = vap->iv_ic;
503 struct net_device *parent = ic->ic_dev;
504 + struct ieee80211_node *tni, *ni;
506 IEEE80211_DPRINTF(vap,
507 IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
508 "%s\n", "stop running");
510 + /* get rid of all wds nodes while we're still locked */
514 + IEEE80211_NODE_TABLE_LOCK_IRQ(&ic->ic_sta);
515 + TAILQ_FOREACH(tni, &ic->ic_sta.nt_node, ni_list) {
516 + if (tni->ni_vap != vap)
518 + if (!tni->ni_subif)
523 + IEEE80211_NODE_TABLE_UNLOCK_IRQ(&ic->ic_sta);
528 + ieee80211_node_leave(ni);
531 ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
532 if (dev->flags & IFF_RUNNING) {
533 dev->flags &= ~IFF_RUNNING; /* mark us stopped */
534 @@ -1630,6 +1654,7 @@
536 if (ni->ni_authmode != IEEE80211_AUTH_8021X)
537 ieee80211_node_authorize(ni);
541 * fire a timer to bring up XR vap if configured.
542 @@ -1885,8 +1910,15 @@
543 if (ostate == IEEE80211_S_SCAN ||
544 ostate == IEEE80211_S_AUTH ||
545 ostate == IEEE80211_S_ASSOC) {
547 /* Transition (S_SCAN|S_AUTH|S_ASSOC) -> S_RUN */
548 __ieee80211_newstate(vap, nstate, arg);
550 + /* if we're in wds, let the ap know that we're doing this */
551 + if ((vap->iv_opmode == IEEE80211_M_STA) &&
552 + (vap->iv_flags_ext & IEEE80211_FEXT_WDS))
553 + ieee80211_send_nulldata(ieee80211_ref_node(vap->iv_bss));
555 /* Then bring up all other vaps pending on the scan */
556 dstate = get_dominant_state(ic);
557 if (dstate == IEEE80211_S_RUN) {
558 --- a/net80211/ieee80211.c
559 +++ b/net80211/ieee80211.c
560 @@ -373,10 +373,25 @@
561 ieee80211_ifdetach(struct ieee80211com *ic)
563 struct ieee80211vap *vap;
566 + /* bring down all vaps */
567 + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
568 + ieee80211_stop(vap->iv_dev);
571 + /* wait for all subifs to disappear */
575 + count = ic->ic_subifs;
577 + } while (count > 0);
580 - while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL)
581 + while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) {
582 ic->ic_vap_delete(vap);
586 del_timer(&ic->ic_dfs_excl_timer);
589 IEEE80211_CANCEL_TQUEUE(&vap->iv_stajoin1tq);
590 IEEE80211_LOCK_IRQ(ic);
591 - if (vap->iv_wdsnode)
592 + if (vap->iv_wdsnode) {
593 + vap->iv_wdsnode->ni_subif = NULL;
594 ieee80211_unref_node(&vap->iv_wdsnode);
596 if ((vap->iv_opmode == IEEE80211_M_WDS) &&
597 (vap->iv_master != NULL))
598 TAILQ_REMOVE(&vap->iv_master->iv_wdslinks, vap, iv_wdsnext);
599 --- a/ath/if_athvar.h
600 +++ b/ath/if_athvar.h
602 #define tasklet_enable(t) do { (void) t; local_bh_enable(); } while (0)
603 #endif /* !DECLARE_TASKLET */
605 -#include <linux/sched.h>
606 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
607 -#include <linux/tqueue.h>
608 -#define work_struct tq_struct
609 -#define schedule_work(t) schedule_task((t))
610 -#define flush_scheduled_work() flush_scheduled_tasks()
611 -#define ATH_INIT_WORK(t, f) do { \
612 - memset((t), 0, sizeof(struct tq_struct)); \
613 - (t)->routine = (void (*)(void*)) (f); \
614 - (t)->data=(void *) (t); \
617 -#include <linux/workqueue.h>
619 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
620 -#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f), (_t));
622 -#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (_f));
625 -#endif /* KERNEL_VERSION < 2.5.41 */
628 * Guess how the interrupt handler should work.
630 --- a/net80211/ieee80211_output.c
631 +++ b/net80211/ieee80211_output.c
636 + if (ni->ni_subif && (vap != ni->ni_subif) &&
637 + ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE)))
640 /* calculate priority so drivers can find the TX queue */
641 if (ieee80211_classify(ni, skb)) {
642 IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni,
643 @@ -340,20 +344,33 @@
644 * constructing a frame as it sets i_fc[1]; other bits can
648 +static struct ieee80211_frame *
649 ieee80211_send_setup(struct ieee80211vap *vap,
650 struct ieee80211_node *ni,
651 - struct ieee80211_frame *wh,
652 + struct sk_buff *skb,
654 const u_int8_t sa[IEEE80211_ADDR_LEN],
655 const u_int8_t da[IEEE80211_ADDR_LEN],
656 const u_int8_t bssid[IEEE80211_ADDR_LEN])
658 #define WH4(wh) ((struct ieee80211_frame_addr4 *)wh)
659 + struct ieee80211_frame *wh;
660 + int len = sizeof(struct ieee80211_frame);
661 + int opmode = vap->iv_opmode;
663 + if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) {
664 + if ((opmode == IEEE80211_M_STA) &&
665 + (vap->iv_flags_ext & IEEE80211_FEXT_WDS))
666 + opmode = IEEE80211_M_WDS;
668 + if (opmode == IEEE80211_M_WDS)
669 + len = sizeof(struct ieee80211_frame_addr4);
672 + wh = (struct ieee80211_frame *)skb_push(skb, len);
673 wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type;
674 if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) {
675 - switch (vap->iv_opmode) {
677 case IEEE80211_M_STA:
678 wh->i_fc[1] = IEEE80211_FC1_DIR_TODS;
679 IEEE80211_ADDR_COPY(wh->i_addr1, bssid);
681 *(__le16 *)&wh->i_seq[0] =
682 htole16(ni->ni_txseqs[0] << IEEE80211_SEQ_SEQ_SHIFT);
691 SKB_CB(skb)->ni = ni;
693 - wh = (struct ieee80211_frame *)
694 - skb_push(skb, sizeof(struct ieee80211_frame));
695 - ieee80211_send_setup(vap, ni, wh,
696 + wh = ieee80211_send_setup(vap, ni, skb,
697 IEEE80211_FC0_TYPE_MGT | type,
698 vap->iv_myaddr, ni->ni_macaddr, vap->iv_bssid);
699 /* XXX power management */
701 struct ieee80211_frame *wh;
705 + vap = ni->ni_subif;
707 skb = ieee80211_getmgtframe(&frm, 0);
714 - wh = (struct ieee80211_frame *)
715 - skb_push(skb, sizeof(struct ieee80211_frame));
716 - ieee80211_send_setup(vap, ni, wh,
717 + wh = ieee80211_send_setup(vap, ni, skb,
718 IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_NODATA,
719 vap->iv_myaddr, ni->ni_macaddr, vap->iv_bssid);
720 /* NB: power management bit is never sent by an AP */
723 struct ieee80211_qosframe *qwh;
728 skb = ieee80211_getmgtframe(&frm, 2);
729 @@ -523,11 +542,12 @@
730 SKB_CB(skb)->ni = ieee80211_ref_node(ni);
733 - qwh = (struct ieee80211_qosframe *)skb_push(skb, sizeof(struct ieee80211_qosframe));
735 - qwh = (struct ieee80211_qosframe *)skb->data;
736 + /* grab a pointer to QoS control and also compensate for the header length
737 + * difference between QoS and non-QoS frame */
738 + i_qos = skb_push(skb, sizeof(struct ieee80211_qosframe) - sizeof(struct ieee80211_frame));
740 - ieee80211_send_setup(vap, ni, (struct ieee80211_frame *)qwh,
741 + qwh = (struct ieee80211_qosframe *) ieee80211_send_setup(vap, ni, skb,
742 IEEE80211_FC0_TYPE_DATA,
743 vap->iv_myaddr, /* SA */
744 ni->ni_macaddr, /* DA */
745 @@ -541,10 +561,10 @@
747 /* map from access class/queue to 11e header priority value */
748 tid = WME_AC_TO_TID(ac);
749 - qwh->i_qos[0] = tid & IEEE80211_QOS_TID;
750 + i_qos[0] = tid & IEEE80211_QOS_TID;
751 if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy)
752 qwh->i_qos[0] |= (1 << IEEE80211_QOS_ACKPOLICY_S) & IEEE80211_QOS_ACKPOLICY;
756 IEEE80211_NODE_STAT(ni, tx_data);
759 hdrsize = sizeof(struct ieee80211_frame);
761 SKB_CB(skb)->auth_pkt = (eh.ether_type == __constant_htons(ETHERTYPE_PAE));
763 + vap = ni->ni_subif;
765 switch (vap->iv_opmode) {
766 case IEEE80211_M_IBSS:
768 ismulticast = IEEE80211_IS_MULTICAST(eh.ether_dhost);
770 case IEEE80211_M_STA:
771 - if ((vap->iv_flags_ext & IEEE80211_FEXT_WDS) &&
772 - !IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)) {
773 + if (vap->iv_flags_ext & IEEE80211_FEXT_WDS) {
775 - ismulticast = IEEE80211_IS_MULTICAST(ni->ni_macaddr);
776 - /* Add a WDS entry to the station VAP */
777 - if (IEEE80211_IS_MULTICAST(eh.ether_dhost)) {
778 - struct ieee80211_node_table *nt = &ic->ic_sta;
779 - struct ieee80211_node *ni_wds
780 - = ieee80211_find_wds_node(nt, eh.ether_shost);
782 - ieee80211_unref_node(&ni_wds);
784 - ieee80211_add_wds_addr(nt, ni, eh.ether_shost, 0);
788 ismulticast = IEEE80211_IS_MULTICAST(vap->iv_bssid);
790 @@ -1689,9 +1700,7 @@
792 SKB_CB(skb)->ni = ieee80211_ref_node(ni);
794 - wh = (struct ieee80211_frame *)
795 - skb_push(skb, sizeof(struct ieee80211_frame));
796 - ieee80211_send_setup(vap, ni, wh,
797 + wh = ieee80211_send_setup(vap, ni, skb,
798 IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ,
800 /* XXX power management? */
801 --- a/net80211/ieee80211_linux.c
802 +++ b/net80211/ieee80211_linux.c
807 - len = roundup(sizeof(struct ieee80211_frame) + pktlen, 4);
808 + len = roundup(sizeof(struct ieee80211_frame_addr4) + pktlen, 4);
809 #ifdef IEEE80211_DEBUG_REFCNT
810 skb = ieee80211_dev_alloc_skb_debug(len + align - 1, func, line);
813 SKB_CB(skb)->flags = 0;
814 SKB_CB(skb)->next = NULL;
816 - skb_reserve(skb, sizeof(struct ieee80211_frame));
817 + skb_reserve(skb, sizeof(struct ieee80211_frame_addr4));
818 *frm = skb_put(skb, pktlen);