e3a6b4690a671ffe3b40edaa08a0a8ac68f88866
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 380-noderef_fix.patch
1 --- a/net80211/ieee80211_node.c
2 +++ b/net80211/ieee80211_node.c
3 @@ -316,7 +316,7 @@
4 */
5 ni = ieee80211_find_node(&ic->ic_sta, vap->iv_myaddr);
6 if (ni == NULL) {
7 - ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
8 + ni = ieee80211_alloc_node(vap, vap->iv_myaddr);
9 IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
10 "%s: ni:%p allocated for " MAC_FMT "\n",
11 __func__, ni, MAC_ADDR(vap->iv_myaddr));
12 @@ -421,14 +421,14 @@
13 /* XXX multi-bss wrong */
14 ieee80211_reset_erp(ic, ic->ic_curmode);
15
16 - ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
17 + ni = ieee80211_alloc_node(vap, vap->iv_myaddr);
18 IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
19 "%s: ni:%p allocated for " MAC_FMT "\n",
20 __func__, ni, MAC_ADDR(vap->iv_myaddr));
21 KASSERT(ni != NULL, ("unable to setup inital BSS node"));
22
23 vap->iv_bss = PASS_NODE(ni);
24 - KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 2),
25 + KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 1),
26 ("wrong refcount for new node."));
27
28 if (obss != NULL) {
29 @@ -630,6 +630,7 @@
30 ieee80211_fix_rate(selbs, IEEE80211_F_DODEL);
31 }
32
33 + IEEE80211_VAPS_LOCK_BH(ic);
34 /*
35 * Committed to selbs, setup state.
36 */
37 @@ -642,8 +643,9 @@
38 (vap->iv_state == IEEE80211_S_RUN) && bssid_equal(obss, selbs)); */
39 vap->iv_bss = selbs;
40 IEEE80211_ADDR_COPY(vap->iv_bssid, selbs->ni_bssid);
41 - if (obss != NULL)
42 + if ((obss != NULL) && (obss != selbs))
43 ieee80211_unref_node(&obss);
44 + IEEE80211_VAPS_UNLOCK_BH(ic);
45 ic->ic_bsschan = selbs->ni_chan;
46 ic->ic_curchan = ic->ic_bsschan;
47 ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
48 --- a/net80211/ieee80211_input.c
49 +++ b/net80211/ieee80211_input.c
50 @@ -3110,7 +3110,7 @@
51 u_int8_t qosinfo;
52
53 if (ni_or_null == NULL)
54 - ni = vap->iv_bss;
55 + ni = ieee80211_ref_node(vap->iv_bss);
56
57 wh = (struct ieee80211_frame *) skb->data;
58 frm = (u_int8_t *)&wh[1];