Backported r12989 for 8.09
[openwrt/svn-archive/archive.git] / package / madwifi / patches-testing / 304-erp_update.patch
1 --- a/net80211/ieee80211_beacon.c
2 +++ b/net80211/ieee80211_beacon.c
3 @@ -544,10 +544,10 @@
4 vap->iv_flags &= ~IEEE80211_F_XRUPDATE;
5 }
6 #endif
7 - if ((ic->ic_flags_ext & IEEE80211_FEXT_ERPUPDATE) &&
8 + if ((vap->iv_flags_ext & IEEE80211_FEXT_ERPUPDATE) &&
9 (bo->bo_erp != NULL)) {
10 (void)ieee80211_add_erp(bo->bo_erp, ic);
11 - ic->ic_flags_ext &= ~IEEE80211_FEXT_ERPUPDATE;
12 + vap->iv_flags_ext &= ~IEEE80211_FEXT_ERPUPDATE;
13 }
14 }
15 /* if it is a mode change beacon for dynamic turbo case */
16 --- a/net80211/ieee80211_input.c
17 +++ b/net80211/ieee80211_input.c
18 @@ -3384,9 +3384,12 @@
19 /* Assume no ERP IE == 11b AP */
20 if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
21 !(ic->ic_flags & IEEE80211_F_USEPROT)) {
22 + struct ieee80211vap *tmpvap;
23
24 ic->ic_flags |= IEEE80211_F_USEPROT;
25 - ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
26 + TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
27 + tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
28 + }
29 }
30 }
31
32 --- a/net80211/ieee80211_node.c
33 +++ b/net80211/ieee80211_node.c
34 @@ -1741,8 +1741,12 @@
35 }
36
37 /* Update ERP element if this is first non ERP station */
38 - if (ic->ic_nonerpsta == 1)
39 - ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
40 + if (ic->ic_nonerpsta == 1) {
41 + struct ieee80211vap *tmpvap;
42 + TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
43 + tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
44 + }
45 + }
46 } else
47 ni->ni_flags |= IEEE80211_NODE_ERP;
48 }
49 @@ -1945,6 +1949,8 @@
50 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni,
51 "non-ERP station leaves, count now %d", ic->ic_nonerpsta);
52 if (ic->ic_nonerpsta == 0) {
53 + struct ieee80211vap *tmpvap;
54 +
55 IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
56 "%s: disable use of protection\n", __func__);
57 ic->ic_flags &= ~IEEE80211_F_USEPROT;
58 @@ -1956,7 +1962,9 @@
59 ic->ic_flags |= IEEE80211_F_SHPREAMBLE;
60 ic->ic_flags &= ~IEEE80211_F_USEBARKER;
61 }
62 - ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
63 + TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
64 + tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
65 + }
66 }
67 }
68 }