huge madwifi update (work in progress, disabled by default, compiles but breaks at...
[openwrt.git] / package / madwifi / patches-r3776 / 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 Index: madwifi-trunk-r3776/ath/if_ath.c
7 ===================================================================
8 --- madwifi-trunk-r3776.orig/ath/if_ath.c       2008-07-17 03:53:09.000000000 +0200
9 +++ madwifi-trunk-r3776/ath/if_ath.c    2008-07-17 04:00:42.000000000 +0200
10 @@ -8272,6 +8272,18 @@
11  #endif
12                                 if (ts->ts_status & HAL_TXERR_XRETRY) {
13                                         sc->sc_stats.ast_tx_xretries++;
14 +                                       if (SKB_CB(bf->bf_skb)->auth_pkt && (ni->ni_vap->iv_opmode == IEEE80211_M_STA)) {
15 +                                               struct ieee80211com *ic = &sc->sc_ic;
16 +
17 +                                               /* if roaming is enabled, try reassociating, otherwise
18 +                                                * disassociate and go back to the scan state */
19 +                                               IEEE80211_VAPS_LOCK_BH(ic);
20 +                                               if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
21 +                                                       ni->ni_vap->iv_newstate(ni->ni_vap, IEEE80211_S_ASSOC, 1);
22 +                                               else
23 +                                                       ni->ni_vap->iv_newstate(ni->ni_vap, IEEE80211_S_SCAN, 0);
24 +                                               IEEE80211_VAPS_UNLOCK_BH(ic);
25 +                                       }
26                                         if (ni->ni_flags & IEEE80211_NODE_UAPSD_TRIG) {
27                                                 ni->ni_stats.ns_tx_eosplost++;
28                                                 DPRINTF(sc, ATH_DEBUG_UAPSD,
29 Index: madwifi-trunk-r3776/net80211/ieee80211_linux.c
30 ===================================================================
31 --- madwifi-trunk-r3776.orig/net80211/ieee80211_linux.c 2008-07-17 00:49:54.000000000 +0200
32 +++ madwifi-trunk-r3776/net80211/ieee80211_linux.c      2008-07-17 04:01:27.000000000 +0200
33 @@ -158,6 +158,7 @@
34  
35                 SKB_NI(skb) = NULL;
36                 SKB_CB(skb)->flags = 0;
37 +               SKB_CB(skb)->auth_pkt = 0;
38  
39                 skb_reserve(skb, sizeof(struct ieee80211_frame));
40                 *frm = skb_put(skb, pktlen);
41 Index: madwifi-trunk-r3776/net80211/ieee80211_linux.h
42 ===================================================================
43 --- madwifi-trunk-r3776.orig/net80211/ieee80211_linux.h 2008-07-17 00:53:20.000000000 +0200
44 +++ madwifi-trunk-r3776/net80211/ieee80211_linux.h      2008-07-17 04:02:15.000000000 +0200
45 @@ -411,6 +411,7 @@
46  #define M_SKB_TRACKED  0x20
47         void            (*next_destructor)(struct sk_buff *skb);
48  #endif
49 +       u_int8_t auth_pkt;
50  };
51  
52  struct __assert {
53 Index: madwifi-trunk-r3776/net80211/ieee80211_output.c
54 ===================================================================
55 --- madwifi-trunk-r3776.orig/net80211/ieee80211_output.c        2008-07-17 02:35:10.000000000 +0200
56 +++ madwifi-trunk-r3776/net80211/ieee80211_output.c     2008-07-17 04:00:42.000000000 +0200
57 @@ -773,6 +773,8 @@
58         else
59                 hdrsize = sizeof(struct ieee80211_frame);
60  
61 +       SKB_CB(skb)->auth_pkt = (eh.ether_type == __constant_htons(ETHERTYPE_PAE));
62 +
63         switch (vap->iv_opmode) {
64         case IEEE80211_M_IBSS:
65         case IEEE80211_M_AHDEMO:
66 @@ -1617,6 +1619,7 @@
67         ie->param_len = frm - &ie->param_oui[0];
68         return frm;
69  }
70 +
71  #endif
72  /*
73   * Send a probe request frame with the specified ssid
74 @@ -1881,6 +1884,7 @@
75                                 sizeof(u_int16_t)+IEEE80211_CHALLENGE_LEN : 0));
76                 if (skb == NULL)
77                         senderr(ENOMEM, is_tx_nobuf);
78 +               SKB_CB(skb)->auth_pkt = 1;
79  
80                 ((__le16 *)frm)[0] =
81                         (is_shared_key) ? htole16(IEEE80211_AUTH_ALG_SHARED)
82 @@ -1955,6 +1959,7 @@
83                         vap->app_ie[IEEE80211_APPIE_FRAME_ASSOC_REQ].length);
84                 if (skb == NULL)
85                         senderr(ENOMEM, is_tx_nobuf);
86 +               SKB_CB(skb)->auth_pkt = 1;
87  
88                 capinfo = 0;
89                 if (vap->iv_opmode == IEEE80211_M_IBSS)