summaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2009-05-06 23:49:55 +0000
committerSam Leffler <sam@FreeBSD.org>2009-05-06 23:49:55 +0000
commita8962181ad927aeb773e821d39e39c1c74e04bee (patch)
treec9fae9f5c3e5f5e8ec212d5169b61dbeff61d2d9 /sys/dev/ath
parenta00b852cabee66db8ae02e29ecd3d713aa4169f9 (diff)
Notes
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/if_ath.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index d0fb6eeaf4bc..8e3f1d426314 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -863,23 +863,26 @@ ath_vap_create(struct ieee80211com *ic,
IEEE80211_ADDR_COPY(mac, mac0);
ATH_LOCK(sc);
+ ic_opmode = opmode; /* default to opmode of new vap */
switch (opmode) {
case IEEE80211_M_STA:
- if (sc->sc_nstavaps != 0) { /* XXX only 1 sta for now */
+ if (sc->sc_nstavaps != 0) { /* XXX only 1 for now */
device_printf(sc->sc_dev, "only 1 sta vap supported\n");
goto bad;
}
if (sc->sc_nvaps) {
/*
- * When there are multiple vaps we must fall
- * back to s/w beacon miss handling.
+ * With multiple vaps we must fall back
+ * to s/w beacon miss handling.
*/
flags |= IEEE80211_CLONE_NOBEACONS;
}
- if (flags & IEEE80211_CLONE_NOBEACONS)
+ if (flags & IEEE80211_CLONE_NOBEACONS) {
+ /*
+ * Station mode w/o beacons are implemented w/ AP mode.
+ */
ic_opmode = IEEE80211_M_HOSTAP;
- else
- ic_opmode = opmode;
+ }
break;
case IEEE80211_M_IBSS:
if (sc->sc_nvaps != 0) { /* XXX only 1 for now */
@@ -887,12 +890,16 @@ ath_vap_create(struct ieee80211com *ic,
"only 1 ibss vap supported\n");
goto bad;
}
- ic_opmode = opmode;
needbeacon = 1;
break;
case IEEE80211_M_AHDEMO:
#ifdef IEEE80211_SUPPORT_TDMA
if (flags & IEEE80211_CLONE_TDMA) {
+ if (sc->sc_nvaps != 0) {
+ device_printf(sc->sc_dev,
+ "only 1 tdma vap supported\n");
+ goto bad;
+ }
needbeacon = 1;
flags |= IEEE80211_CLONE_NOBEACONS;
}
@@ -900,29 +907,34 @@ ath_vap_create(struct ieee80211com *ic,
#endif
case IEEE80211_M_MONITOR:
if (sc->sc_nvaps != 0 && ic->ic_opmode != opmode) {
+ /*
+ * Adopt existing mode. Adding a monitor or ahdemo
+ * vap to an existing configuration is of dubious
+ * value but should be ok.
+ */
/* XXX not right for monitor mode */
ic_opmode = ic->ic_opmode;
- } else
- ic_opmode = opmode;
+ }
break;
case IEEE80211_M_HOSTAP:
needbeacon = 1;
- /* fall thru... */
+ break;
case IEEE80211_M_WDS:
- if (sc->sc_nvaps && ic->ic_opmode == IEEE80211_M_STA) {
+ if (sc->sc_nvaps != 0 && ic->ic_opmode == IEEE80211_M_STA) {
device_printf(sc->sc_dev,
"wds not supported in sta mode\n");
goto bad;
}
- if (opmode == IEEE80211_M_WDS) {
- /*
- * Silently remove any request for a unique
- * bssid; WDS vap's always share the local
- * mac address.
- */
- flags &= ~IEEE80211_CLONE_BSSID;
- }
- ic_opmode = IEEE80211_M_HOSTAP;
+ /*
+ * Silently remove any request for a unique
+ * bssid; WDS vap's always share the local
+ * mac address.
+ */
+ flags &= ~IEEE80211_CLONE_BSSID;
+ if (sc->sc_nvaps == 0)
+ ic_opmode = IEEE80211_M_HOSTAP;
+ else
+ ic_opmode = ic->ic_opmode;
break;
default:
device_printf(sc->sc_dev, "unknown opmode %d\n", opmode);