From owner-svn-src-all@FreeBSD.ORG Wed May 6 23:49:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1399F106566B; Wed, 6 May 2009 23:49:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB2638FC16; Wed, 6 May 2009 23:49:55 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n46NntZE033666; Wed, 6 May 2009 23:49:55 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n46NntRr033664; Wed, 6 May 2009 23:49:55 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905062349.n46NntRr033664@svn.freebsd.org> From: Sam Leffler Date: Wed, 6 May 2009 23:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191865 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 23:49:56 -0000 Author: sam Date: Wed May 6 23:49:55 2009 New Revision: 191865 URL: http://svn.freebsd.org/changeset/base/191865 Log: o cleanup checks for which vap combinations are permitted and what to use for ic_opmode o fixes the case where creating ahdemo+wds vaps caused ic_opmode to be set to hostap Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed May 6 23:09:26 2009 (r191864) +++ head/sys/dev/ath/if_ath.c Wed May 6 23:49:55 2009 (r191865) @@ -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);