summaryrefslogtreecommitdiffstats
path: root/sys/dev/if_ndis
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-05-29 06:41:17 +0000
committerwpaul <wpaul@FreeBSD.org>2004-05-29 06:41:17 +0000
commit86ad4bc57206e1e6d93096c4a7c71098de9917ff (patch)
treed249a6d168e11421eecdd8440ae5e3363334218f /sys/dev/if_ndis
parent8b3638ddb28484b21ce4c706ef2d96745d7315cf (diff)
downloadFreeBSD-src-86ad4bc57206e1e6d93096c4a7c71098de9917ff.zip
FreeBSD-src-86ad4bc57206e1e6d93096c4a7c71098de9917ff.tar.gz
In subr_ndis.c, when searching for keys in our make-pretend registry,
make the key name matching case-insensitive. There are some drivers and .inf files that have mismatched cases, e.g. the driver will look for "AdhocBand" whereas the .inf file specifies a registry key to be created called "AdHocBand." The mismatch is probably a typo that went undetected (so much for QA), but since Windows seems to be case-insensitive, we should be too. In if_ndis.c, initialize rates and channels correctly so that specify frequences correctly when trying to set channels in the 5Ghz band, and so that 802.11b rates show up for some a/b/g cards (which otherwise appear to have no 802.11b modes). Also, when setting OID_802_11_CONFIGURATION in ndis_80211_setstate(), provide default values for the beacon interval, ATIM window and dwelltime. The Atheros "Aries" driver will crash if you try to select ad-hoc mode and leave the beacon interval set to 0: it blindly uses this value and does a division by 0 in the interrupt handler, causing an integer divide trap.
Diffstat (limited to 'sys/dev/if_ndis')
-rw-r--r--sys/dev/if_ndis/if_ndis.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index 3b2f003..827e097 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -484,7 +484,7 @@ ndis_attach(dev)
/* Do media setup */
if (sc->ndis_80211) {
struct ieee80211com *ic = (void *)ifp;
- ndis_80211_rates_ex rates;
+ ndis_80211_rates/*_ex*/ rates;
struct ndis_80211_nettype_list *ntl;
uint32_t arg;
int r;
@@ -510,8 +510,6 @@ ndis_attach(dev)
for (i = 0; i < ntl->ntl_items; i++) {
switch (ntl->ntl_type[i]) {
case NDIS_80211_NETTYPE_11FH:
- ic->ic_modecaps |= (1<<IEEE80211_MODE_11B);
- break;
case NDIS_80211_NETTYPE_11DS:
ic->ic_modecaps |= (1<<IEEE80211_MODE_11B);
break;
@@ -602,6 +600,12 @@ nonettypes:
* just cheat here. Just how in the heck do
* we detect turbo modes, though?
*/
+ if (ic->ic_modecaps & (1<<IEEE80211_MODE_11B)) {
+ TESTSETRATE(IEEE80211_MODE_11B, 2);
+ TESTSETRATE(IEEE80211_MODE_11B, 4);
+ TESTSETRATE(IEEE80211_MODE_11B, 11);
+ TESTSETRATE(IEEE80211_MODE_11B, 22);
+ }
if (ic->ic_modecaps & (1<<IEEE80211_MODE_11G)) {
TESTSETRATE(IEEE80211_MODE_11G, 47);
TESTSETRATE(IEEE80211_MODE_11G, 72);
@@ -626,6 +630,8 @@ nonettypes:
chanflag |= IEEE80211_CHAN_G;
if (i <= 14)
chanflag |= IEEE80211_CHAN_B;
+ if (i > 14)
+ chanflag = IEEE80211_CHAN_A;
if (chanflag == 0)
break;
ic->ic_channels[i].ic_freq =
@@ -1508,12 +1514,53 @@ ndis_setstate_80211(sc)
device_printf (sc->ndis_dev, "set auth failed: %d\n", rval);
#endif
+#ifdef notyet
+ /* Set network type. */
+
+ arg = 0;
+
+ switch (ic->ic_curmode) {
+ case IEEE80211_MODE_11A:
+ arg = NDIS_80211_NETTYPE_11OFDM5;
+ break;
+ case IEEE80211_MODE_11B:
+ arg = NDIS_80211_NETTYPE_11DS;
+ break;
+ case IEEE80211_MODE_11G:
+ arg = NDIS_80211_NETTYPE_11OFDM24;
+ break;
+ default:
+ device_printf(sc->ndis_dev, "unknown mode: %d\n",
+ ic->ic_curmode);
+ }
+#endif
+
+ if (arg) {
+ len = sizeof(arg);
+ rval = ndis_set_info(sc, OID_802_11_NETWORK_TYPE_IN_USE,
+ &arg, &len);
+ if (rval)
+ device_printf (sc->ndis_dev,
+ "set nettype failed: %d\n", rval);
+ }
+
len = sizeof(config);
bzero((char *)&config, len);
config.nc_length = len;
config.nc_fhconfig.ncf_length = sizeof(ndis_80211_config_fh);
rval = ndis_get_info(sc, OID_802_11_CONFIGURATION, &config, &len);
+ /*
+ * Some drivers expect us to initialize these values, so
+ * provide some defaults.
+ */
+ if (config.nc_beaconperiod == 0)
+ config.nc_beaconperiod = 100;
+ if (config.nc_atimwin == 0)
+ config.nc_atimwin = 100;
+ if (config.nc_fhconfig.ncf_dwelltime == 0)
+ config.nc_fhconfig.ncf_dwelltime = 200;
+
if (rval == 0 && ic->ic_ibss_chan != IEEE80211_CHAN_ANYC) {
int chan, chanflag;
OpenPOWER on IntegriCloud