1 diff -urN madwifi-ng-r2377-20070526.old/ath/if_ath.c madwifi-ng-r2377-20070526.dev/ath/if_ath.c
2 --- madwifi-ng-r2377-20070526.old/ath/if_ath.c 2007-05-26 18:51:09.426654472 +0200
3 +++ madwifi-ng-r2377-20070526.dev/ath/if_ath.c 2007-05-26 18:51:09.440652344 +0200
5 rfilt |= HAL_RX_FILTER_PROM;
6 if (ic->ic_opmode == IEEE80211_M_STA ||
7 sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
8 - (sc->sc_nostabeacons) || sc->sc_scanning)
9 + (sc->sc_nostabeacons) || sc->sc_scanning ||
10 + ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
11 + (ic->ic_protmode != IEEE80211_PROT_NONE)))
12 rfilt |= HAL_RX_FILTER_BEACON;
13 if (sc->sc_nmonvaps > 0)
14 rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
15 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_input.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_input.c
16 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_input.c 2007-05-26 18:51:09.429654016 +0200
17 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_input.c 2007-05-26 18:51:09.443651888 +0200
22 - * Validate the bssid.
23 + * Validate the bssid. Let beacons get through though for 11g protection mode.
26 if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
27 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
28 + !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
29 + (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
31 * allow MGT frames to vap->iv_xrvap.
32 * this will allow roaming between XR and normal vaps
36 if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
37 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
38 + !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
39 + (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
40 /* not interested in */
41 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
42 bssid, NULL, "%s", "not to bss");
45 u_int8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath;
47 - int reassoc, resp, allocbs = 0;
48 + int reassoc, resp, allocbs = 0, has_erp = 0;
51 wh = (struct ieee80211_frame *) skb->data;
52 @@ -2615,11 +2617,15 @@
53 * o station mode when associated (to collect state
54 * updates such as 802.11g slot time), or
55 * o adhoc mode (to discover neighbors)
56 + * o ap mode in protection mode (beacons only)
57 * Frames otherwise received are discarded.
59 if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
60 (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
61 - vap->iv_opmode == IEEE80211_M_IBSS)) {
62 + (vap->iv_opmode == IEEE80211_M_IBSS) ||
63 + ((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
64 + (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
65 + (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
66 vap->iv_stats.is_rx_mgtdiscard++;
75 case IEEE80211_ELEMID_RSN:
78 vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) {
79 mod_timer(&vap->iv_swbmiss, jiffies + vap->iv_swbmiss_period);
84 * If scanning, pass the info to the scan module.
85 * Otherwise, check if it's the right time to do
86 @@ -2877,6 +2884,20 @@
87 ieee80211_bg_scan(vap);
91 + /* Update AP protection mode when in 11G mode */
92 + if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
93 + IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
95 + /* Assume no ERP IE == 11b AP */
96 + if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
97 + !(ic->ic_flags & IEEE80211_F_USEPROT)) {
99 + ic->ic_flags |= IEEE80211_F_USEPROT;
100 + ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
105 * If scanning, just pass information to the scan module.
107 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c
108 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c 2007-05-26 18:51:09.430653864 +0200
109 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c 2007-05-26 18:51:09.444651736 +0200
110 @@ -332,10 +332,16 @@
111 /* Update country ie information */
112 ieee80211_build_countryie(ic);
114 - if (IEEE80211_IS_CHAN_HALF(chan))
115 + if (IEEE80211_IS_CHAN_HALF(chan)) {
116 ni->ni_rates = ic->ic_sup_half_rates;
117 - else if (IEEE80211_IS_CHAN_QUARTER(chan))
118 + } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
119 ni->ni_rates = ic->ic_sup_quarter_rates;
122 + if ((vap->iv_flags & IEEE80211_F_PUREG) &&
123 + IEEE80211_IS_CHAN_ANYG(chan)) {
124 + ieee80211_setpuregbasicrates(&ni->ni_rates);
127 (void) ieee80211_sta_join1(PASS_NODE(ni));
129 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c
130 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c 2007-05-26 18:51:09.431653712 +0200
131 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c 2007-05-26 18:51:09.445651584 +0200
133 { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_TURBO_G (mixed b/g) */
136 +static const struct ieee80211_rateset basicpureg[] = {
137 + { 7, {2, 4, 11, 22, 12, 24, 48 } },
141 + * Mark basic rates for the 11g rate table based on the pureg setting
144 +ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
148 + for (i = 0; i < rs->rs_nrates; i++) {
149 + rs->rs_rates[i] &= IEEE80211_RATE_VAL;
150 + for (j = 0; j < basicpureg[0].rs_nrates; j++)
151 + if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
152 + rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
159 * Mark the basic rates for the 11g rate table based on the
160 * specified mode. For 11b compatibility we mark only 11b
161 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h
162 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h 2007-05-26 18:51:09.321670432 +0200
163 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h 2007-05-26 18:51:09.445651584 +0200
165 void ieee80211_build_countryie(struct ieee80211com *);
166 int ieee80211_media_setup(struct ieee80211com *, struct ifmedia *, u_int32_t,
167 ifm_change_cb_t, ifm_stat_cb_t);
168 +void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
171 /* Key update synchronization methods. XXX should not be visible. */