mac80211: upgrade to a new unofficial snapshot based on wireless-testing+wireless-2.6
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 540-wds_assoc_dummyframe.patch
1 --- a/net/mac80211/mlme.c
2 +++ b/net/mac80211/mlme.c
3 @@ -312,6 +312,38 @@ void ieee80211_send_nullfunc(struct ieee
4 ieee80211_tx_skb(sdata, skb);
5 }
6
7 +static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
8 + struct ieee80211_sub_if_data *sdata)
9 +{
10 + struct sk_buff *skb;
11 + struct ieee80211_hdr *nullfunc;
12 + __le16 fc;
13 +
14 + if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
15 + return;
16 +
17 + skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30);
18 + if (!skb) {
19 + printk(KERN_DEBUG "%s: failed to allocate buffer for 4addr "
20 + "nullfunc frame\n", sdata->name);
21 + return;
22 + }
23 + skb_reserve(skb, local->hw.extra_tx_headroom);
24 +
25 + nullfunc = (struct ieee80211_hdr *) skb_put(skb, 30);
26 + memset(nullfunc, 0, 30);
27 + fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
28 + IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS);
29 + nullfunc->frame_control = fc;
30 + memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN);
31 + memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN);
32 + memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN);
33 + memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN);
34 +
35 + IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
36 + ieee80211_tx_skb(sdata, skb);
37 +}
38 +
39 /* spectrum management related things */
40 static void ieee80211_chswitch_work(struct work_struct *work)
41 {
42 @@ -1120,6 +1152,13 @@ static bool ieee80211_assoc_success(stru
43 ieee80211_set_associated(sdata, cbss, changed);
44
45 /*
46 + * If we're using 4-addr mode, let the AP know that we're
47 + * doing so, so that it can create the STA VLAN on its side
48 + */
49 + if (ifmgd->use_4addr)
50 + ieee80211_send_4addr_nullfunc(local, sdata);
51 +
52 + /*
53 * Start timer to probe the connection to the AP now.
54 * Also start the timer that will detect beacon loss.
55 */
56 --- a/net/mac80211/rx.c
57 +++ b/net/mac80211/rx.c
58 @@ -1111,6 +1111,18 @@ ieee80211_rx_h_sta_process(struct ieee80
59 if (ieee80211_is_nullfunc(hdr->frame_control) ||
60 ieee80211_is_qos_nullfunc(hdr->frame_control)) {
61 I802_DEBUG_INC(rx->local->rx_handlers_drop_nullfunc);
62 +
63 + /*
64 + * If we receive a 4-addr nullfunc frame from a STA
65 + * that was not moved to a 4-addr STA vlan yet, drop
66 + * the frame to the monitor interface, to make sure
67 + * that hostapd sees it
68 + */
69 + if (ieee80211_has_a4(hdr->frame_control) &&
70 + (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
71 + (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
72 + !rx->sdata->u.vlan.sta)))
73 + return RX_DROP_MONITOR;
74 /*
75 * Update counter and free packet here to avoid
76 * counting this as a dropped packed.