a1d9b0ba4edd7cd932a0fc228c9028cefc4791be
[openwrt/svn-archive/archive.git] / package / madwifi / patches-testing / 319-eap_auth_disassoc.patch
1 This patch causes STA mode interfaces to disassociate if transmission of assoc/auth
2 critical packets failed.
3
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
5
6 --- a/ath/if_ath.c
7 +++ b/ath/if_ath.c
8 @@ -8273,6 +8273,18 @@
9 #endif
10 if (ts->ts_status & HAL_TXERR_XRETRY) {
11 sc->sc_stats.ast_tx_xretries++;
12 + if (SKB_CB(bf->bf_skb)->auth_pkt && (ni->ni_vap->iv_opmode == IEEE80211_M_STA)) {
13 + struct ieee80211com *ic = &sc->sc_ic;
14 +
15 + /* if roaming is enabled, try reassociating, otherwise
16 + * disassociate and go back to the scan state */
17 + IEEE80211_VAPS_LOCK_BH(ic);
18 + if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
19 + ni->ni_vap->iv_newstate(ni->ni_vap, IEEE80211_S_ASSOC, 1);
20 + else
21 + ni->ni_vap->iv_newstate(ni->ni_vap, IEEE80211_S_SCAN, 0);
22 + IEEE80211_VAPS_UNLOCK_BH(ic);
23 + }
24 if (ni->ni_flags & IEEE80211_NODE_UAPSD_TRIG) {
25 ni->ni_stats.ns_tx_eosplost++;
26 DPRINTF(sc, ATH_DEBUG_UAPSD,
27 --- a/net80211/ieee80211_linux.c
28 +++ b/net80211/ieee80211_linux.c
29 @@ -158,6 +158,7 @@
30
31 SKB_NI(skb) = NULL;
32 SKB_CB(skb)->flags = 0;
33 + SKB_CB(skb)->auth_pkt = 0;
34
35 skb_reserve(skb, sizeof(struct ieee80211_frame));
36 *frm = skb_put(skb, pktlen);
37 --- a/net80211/ieee80211_linux.h
38 +++ b/net80211/ieee80211_linux.h
39 @@ -411,6 +411,7 @@
40 #define M_SKB_TRACKED 0x20
41 void (*next_destructor)(struct sk_buff *skb);
42 #endif
43 + u_int8_t auth_pkt;
44 };
45
46 struct __assert {
47 --- a/net80211/ieee80211_output.c
48 +++ b/net80211/ieee80211_output.c
49 @@ -773,6 +773,8 @@
50 else
51 hdrsize = sizeof(struct ieee80211_frame);
52
53 + SKB_CB(skb)->auth_pkt = (eh.ether_type == __constant_htons(ETHERTYPE_PAE));
54 +
55 switch (vap->iv_opmode) {
56 case IEEE80211_M_IBSS:
57 case IEEE80211_M_AHDEMO:
58 @@ -1617,6 +1619,7 @@
59 ie->param_len = frm - &ie->param_oui[0];
60 return frm;
61 }
62 +
63 #endif
64 /*
65 * Send a probe request frame with the specified ssid
66 @@ -1881,6 +1884,7 @@
67 sizeof(u_int16_t)+IEEE80211_CHALLENGE_LEN : 0));
68 if (skb == NULL)
69 senderr(ENOMEM, is_tx_nobuf);
70 + SKB_CB(skb)->auth_pkt = 1;
71
72 ((__le16 *)frm)[0] =
73 (is_shared_key) ? htole16(IEEE80211_AUTH_ALG_SHARED)
74 @@ -1955,6 +1959,7 @@
75 vap->app_ie[IEEE80211_APPIE_FRAME_ASSOC_REQ].length);
76 if (skb == NULL)
77 senderr(ENOMEM, is_tx_nobuf);
78 + SKB_CB(skb)->auth_pkt = 1;
79
80 capinfo = 0;
81 if (vap->iv_opmode == IEEE80211_M_IBSS)