7785dc1d787453dbda20e5117c57a73fc465a41e
[openwrt.git] / package / madwifi / patches / 451-ibss_race_fix.patch
1 --- a/net80211/ieee80211_input.c
2 +++ b/net80211/ieee80211_input.c
3 @@ -322,7 +322,6 @@ ieee80211_input(struct ieee80211vap * va
4 }
5 /* Do not try to find a node reference if the packet really did come from the BSS */
6 if (type == IEEE80211_FC0_TYPE_DATA && ni == vap->iv_bss &&
7 - !IEEE80211_ADDR_EQ(vap->iv_bss->ni_macaddr, wh->i_addr2) &&
8 IEEE80211_ADDR_EQ(vap->iv_bssid, wh->i_addr3)) {
9 /* Try to find sender in local node table. */
10 ni = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
11 @@ -3572,10 +3571,12 @@ ieee80211_recv_mgmt(struct ieee80211vap
12 } else if (vap->iv_opmode == IEEE80211_M_WDS) {
13 found = 1;
14 ni = ni_or_null = vap->iv_wdsnode;
15 - } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
16 + } else if ((vap->iv_opmode == IEEE80211_M_IBSS) && (vap->iv_state == IEEE80211_S_RUN)) {
17 ni_or_null = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
18 - if (ni_or_null)
19 + if (ni_or_null) {
20 ni = ni_or_null;
21 + do_unref = 1;
22 + }
23 found = 1;
24 }
25 IEEE80211_UNLOCK_IRQ(vap->iv_ic);
26 --- a/net80211/ieee80211_node.c
27 +++ b/net80211/ieee80211_node.c
28 @@ -317,16 +317,16 @@ ieee80211_create_ibss(struct ieee80211va
29 /* Check to see if we already have a node for this mac
30 * NB: we gain a node reference here
31 */
32 - ni = ieee80211_find_txnode(vap, vap->iv_myaddr);
33 + ni = ieee80211_find_node(&ic->ic_sta, vap->iv_myaddr);
34 + if (ni) {
35 + ieee80211_node_leave(ni);
36 + ieee80211_unref_node(&ni);
37 + }
38 +
39 + ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
40 if (ni == NULL) {
41 - ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
42 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
43 - "%s: ni:%p allocated for " MAC_FMT "\n",
44 - __func__, ni, MAC_ADDR(vap->iv_myaddr));
45 - if (ni == NULL) {
46 - /* XXX recovery? */
47 - return;
48 - }
49 + /* XXX recovery? */
50 + return;
51 }
52
53 IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
54 @@ -759,6 +759,9 @@ ieee80211_sta_join(struct ieee80211vap *
55 ieee80211_setup_rates(ni, se->se_rates, se->se_xrates,
56 IEEE80211_F_DOSORT | IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
57
58 + if (vap->iv_opmode == IEEE80211_M_IBSS)
59 + ieee80211_node_table_reset(&vap->iv_ic->ic_sta, vap);
60 +
61 return ieee80211_sta_join1(PASS_NODE(ni));
62 }
63 EXPORT_SYMBOL(ieee80211_sta_join);
64 --- a/ath/if_ath.c
65 +++ b/ath/if_ath.c
66 @@ -6655,10 +6655,8 @@ ath_recv_mgmt(struct ieee80211vap * vap,
67 * if the difference it too small. Otherwise we are playing
68 * tsf-pingpong with other vendors drivers */
69 beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
70 - if (beacon_tsf > rtsf + 0xffff) {
71 + if (beacon_tsf > rtsf + 0xffff)
72 ath_hal_settsf64(sc->sc_ah, beacon_tsf - rtsf);
73 - ieee80211_ibss_merge(ni);
74 - }
75 break;
76 }
77 /* NB: Fall Through */
This page took 0.040767 seconds and 3 git commands to generate.