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 @@ -2577,11 +2579,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:
77 @@ -2839,6 +2846,20 @@
78 ieee80211_bg_scan(vap);
82 + /* Update AP protection mode when in 11G mode */
83 + if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
84 + IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
86 + /* Assume no ERP IE == 11b AP */
87 + if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
88 + !(ic->ic_flags & IEEE80211_F_USEPROT)) {
90 + ic->ic_flags |= IEEE80211_F_USEPROT;
91 + ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
96 * If scanning, just pass information to the scan module.
98 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c
99 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c 2007-05-26 18:51:09.430653864 +0200
100 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c 2007-05-26 18:51:09.444651736 +0200
101 @@ -332,10 +332,16 @@
102 /* Update country ie information */
103 ieee80211_build_countryie(ic);
105 - if (IEEE80211_IS_CHAN_HALF(chan))
106 + if (IEEE80211_IS_CHAN_HALF(chan)) {
107 ni->ni_rates = ic->ic_sup_half_rates;
108 - else if (IEEE80211_IS_CHAN_QUARTER(chan))
109 + } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
110 ni->ni_rates = ic->ic_sup_quarter_rates;
113 + if ((vap->iv_flags & IEEE80211_F_PUREG) &&
114 + IEEE80211_IS_CHAN_ANYG(chan)) {
115 + ieee80211_setpuregbasicrates(&ni->ni_rates);
118 (void) ieee80211_sta_join1(PASS_NODE(ni));
120 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c
121 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c 2007-05-26 18:51:09.431653712 +0200
122 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c 2007-05-26 18:51:09.445651584 +0200
124 { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_TURBO_G (mixed b/g) */
127 +static const struct ieee80211_rateset basicpureg[] = {
128 + { 7, {2, 4, 11, 22, 12, 24, 48 } },
132 + * Mark basic rates for the 11g rate table based on the pureg setting
135 +ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
139 + for (i = 0; i < rs->rs_nrates; i++) {
140 + rs->rs_rates[i] &= IEEE80211_RATE_VAL;
141 + for (j = 0; j < basicpureg[0].rs_nrates; j++)
142 + if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
143 + rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
150 * Mark the basic rates for the 11g rate table based on the
151 * specified mode. For 11b compatibility we mark only 11b
152 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h
153 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h 2007-05-26 18:51:09.321670432 +0200
154 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h 2007-05-26 18:51:09.445651584 +0200
156 void ieee80211_build_countryie(struct ieee80211com *);
157 int ieee80211_media_setup(struct ieee80211com *, struct ifmedia *, u_int32_t,
158 ifm_change_cb_t, ifm_stat_cb_t);
159 +void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
162 /* Key update synchronization methods. XXX should not be visible. */