From owner-svn-src-head@FreeBSD.ORG Sun Mar 15 21:18:19 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63D5E512; Sun, 15 Mar 2015 21:18:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4589B898; Sun, 15 Mar 2015 21:18:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2FLIJJO085763; Sun, 15 Mar 2015 21:18:19 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2FLII17085761; Sun, 15 Mar 2015 21:18:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503152118.t2FLII17085761@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 15 Mar 2015 21:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280105 - head/sys/dev/wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2015 21:18:19 -0000 Author: adrian Date: Sun Mar 15 21:18:18 2015 New Revision: 280105 URL: https://svnweb.freebsd.org/changeset/base/280105 Log: Add experimental HOSTAP support. PR: kern/197143 Submitted by: Andriy Voskoboinyk Modified: head/sys/dev/wpi/if_wpi.c head/sys/dev/wpi/if_wpireg.h Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:17:58 2015 (r280104) +++ head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:18:18 2015 (r280105) @@ -447,6 +447,7 @@ wpi_attach(device_t dev) ic->ic_caps = IEEE80211_C_STA /* station mode supported */ | IEEE80211_C_IBSS /* IBSS mode supported */ + | IEEE80211_C_HOSTAP /* Host access point mode */ | IEEE80211_C_MONITOR /* monitor mode supported */ | IEEE80211_C_AHDEMO /* adhoc demo mode */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ @@ -454,9 +455,6 @@ wpi_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA /* 802.11i */ | IEEE80211_C_SHPREAMBLE /* short preamble supported */ -#if 0 - | IEEE80211_C_HOSTAP /* Host access point mode */ -#endif | IEEE80211_C_WME /* 802.11e */ | IEEE80211_C_PMGT /* Station-side power mgmt */ ; @@ -624,7 +622,7 @@ wpi_vap_create(struct ieee80211com *ic, vap = &wvp->wv_vap; ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); - if (opmode == IEEE80211_M_IBSS) { + if (opmode == IEEE80211_M_IBSS || opmode == IEEE80211_M_HOSTAP) { WPI_VAP_LOCK_INIT(wvp); wpi_init_beacon(wvp); } @@ -635,6 +633,7 @@ wpi_vap_create(struct ieee80211com *ic, wvp->wv_newstate = vap->iv_newstate; vap->iv_newstate = wpi_newstate; vap->iv_update_beacon = wpi_update_beacon; + vap->iv_max_aid = WPI_ID_IBSS_MAX - WPI_ID_IBSS_MIN + 1; ieee80211_ratectl_init(vap); /* Complete setup. */ @@ -654,7 +653,7 @@ wpi_vap_delete(struct ieee80211vap *vap) ieee80211_ratectl_deinit(vap); ieee80211_vap_detach(vap); - if (opmode == IEEE80211_M_IBSS) { + if (opmode == IEEE80211_M_IBSS || opmode == IEEE80211_M_HOSTAP) { if (bcn->m != NULL) m_freem(bcn->m); @@ -1382,6 +1381,10 @@ wpi_eeprom_channel_flags(struct wpi_eepr nflags |= IEEE80211_CHAN_NOADHOC; } + /* XXX HOSTAP uses WPI_MODE_IBSS */ + if (nflags & IEEE80211_CHAN_NOADHOC) + nflags |= IEEE80211_CHAN_NOHOSTAP; + return nflags; } @@ -1650,9 +1653,8 @@ wpi_newstate(struct ieee80211vap *vap, e WPI_LOCK(sc); switch (nstate) { case IEEE80211_S_SCAN: - if ((vap->iv_opmode == IEEE80211_M_IBSS || - vap->iv_opmode == IEEE80211_M_AHDEMO) && - (sc->rxon.filter & htole32(WPI_FILTER_BSS))) { + if ((sc->rxon.filter & htole32(WPI_FILTER_BSS)) && + vap->iv_opmode != IEEE80211_M_STA) { sc->rxon.filter &= ~htole32(WPI_FILTER_BSS); if ((error = wpi_send_rxon(sc, 0, 1)) != 0) { device_printf(sc->sc_dev, @@ -3321,9 +3323,13 @@ static void wpi_set_promisc(struct wpi_softc *sc) { struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); uint32_t promisc_filter; - promisc_filter = WPI_FILTER_PROMISC | WPI_FILTER_CTL; + promisc_filter = WPI_FILTER_CTL; + if (vap != NULL && vap->iv_opmode != IEEE80211_M_HOSTAP) + promisc_filter |= WPI_FILTER_PROMISC; if (ifp->if_flags & IFF_PROMISC) sc->rxon.filter |= htole32(promisc_filter); @@ -3730,9 +3736,13 @@ wpi_config(struct wpi_softc *sc) sc->rxon.mode = WPI_MODE_IBSS; sc->rxon.filter |= WPI_FILTER_BEACON; break; - /* XXX workaround for passive channels selection */ - case IEEE80211_M_AHDEMO: case IEEE80211_M_HOSTAP: + /* XXX workaround for beaconing */ + sc->rxon.mode = WPI_MODE_IBSS; + sc->rxon.filter |= WPI_FILTER_ASSOC | WPI_FILTER_PROMISC; + break; + case IEEE80211_M_AHDEMO: + /* XXX workaround for passive channels selection */ sc->rxon.mode = WPI_MODE_HOSTAP; break; case IEEE80211_M_MONITOR: @@ -4275,7 +4285,8 @@ wpi_run(struct wpi_softc *sc, struct iee return error; } - if (vap->iv_opmode == IEEE80211_M_IBSS) { + if (vap->iv_opmode == IEEE80211_M_IBSS || + vap->iv_opmode == IEEE80211_M_HOSTAP) { if ((error = wpi_setup_beacon(sc, ni)) != 0) { device_printf(sc->sc_dev, "%s: could not setup beacon, error %d\n", __func__, @@ -4533,6 +4544,7 @@ wpi_process_key(struct ieee80211vap *vap case IEEE80211_M_IBSS: case IEEE80211_M_AHDEMO: + case IEEE80211_M_HOSTAP: ni = ieee80211_find_vap_node(&ic->ic_sta, vap, k->wk_macaddr); if (ni == NULL) return 0; /* should not happen */ Modified: head/sys/dev/wpi/if_wpireg.h ============================================================================== --- head/sys/dev/wpi/if_wpireg.h Sun Mar 15 21:17:58 2015 (r280104) +++ head/sys/dev/wpi/if_wpireg.h Sun Mar 15 21:18:18 2015 (r280105) @@ -375,6 +375,7 @@ struct wpi_rxon { #define WPI_FILTER_NODECRYPT (1 << 3) #define WPI_FILTER_BSS (1 << 5) #define WPI_FILTER_BEACON (1 << 6) +#define WPI_FILTER_ASSOC (1 << 7) /* Accept associaton requests. */ uint8_t chan; uint16_t reserved5;