From owner-svn-src-all@freebsd.org Thu Apr 21 05:47:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1788B171FB; Thu, 21 Apr 2016 05:47:48 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AE3F8180C; Thu, 21 Apr 2016 05:47:48 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3L5llhR044474; Thu, 21 Apr 2016 05:47:47 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3L5ll5v044470; Thu, 21 Apr 2016 05:47:47 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201604210547.u3L5ll5v044470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 21 Apr 2016 05:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298389 - in head/sys: dev/malo dev/mwl net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 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: Thu, 21 Apr 2016 05:47:48 -0000 Author: avos Date: Thu Apr 21 05:47:47 2016 New Revision: 298389 URL: https://svnweb.freebsd.org/changeset/base/298389 Log: net80211: enable promiscuous mode state change for non-monitor/ahdemo modes - Allow to enable/disable promiscuous mode when: * interface is not a member of bridge, or; * request was issued by user (ifconfig wlan0 promisc), or; * interface is in MONITOR or AHDEMO mode. - Drop local workarounds in mwl(4) and malo(4). Tested with: - Intel 3945BG, STA mode; - RTL8188CUS, MONITOR mode; Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D5472 Modified: head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Thu Apr 21 05:24:47 2016 (r298388) +++ head/sys/dev/malo/if_malo.c Thu Apr 21 05:47:47 2016 (r298389) @@ -1570,14 +1570,7 @@ malo_mode_init(struct malo_softc *sc) struct ieee80211com *ic = &sc->malo_ic; struct malo_hal *mh = sc->malo_mh; - /* - * NB: Ignore promisc in hostap mode; it's set by the - * bridge. This is wrong but we have no way to - * identify internal requests (from the bridge) - * versus external requests such as for tcpdump. - */ - malo_hal_setpromisc(mh, ic->ic_promisc > 0 && - ic->ic_opmode != IEEE80211_M_HOSTAP); + malo_hal_setpromisc(mh, ic->ic_promisc > 0); malo_setmcastfilter(sc); return ENXIO; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Thu Apr 21 05:24:47 2016 (r298388) +++ head/sys/dev/mwl/if_mwl.c Thu Apr 21 05:47:47 2016 (r298389) @@ -1753,14 +1753,7 @@ mwl_mode_init(struct mwl_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct mwl_hal *mh = sc->sc_mh; - /* - * NB: Ignore promisc in hostap mode; it's set by the - * bridge. This is wrong but we have no way to - * identify internal requests (from the bridge) - * versus external requests such as for tcpdump. - */ - mwl_hal_setpromisc(mh, ic->ic_promisc > 0 && - ic->ic_opmode != IEEE80211_M_HOSTAP); + mwl_hal_setpromisc(mh, ic->ic_promisc > 0); mwl_setmcastfilter(sc); return 0; Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Thu Apr 21 05:24:47 2016 (r298388) +++ head/sys/net80211/ieee80211.c Thu Apr 21 05:47:47 2016 (r298389) @@ -704,16 +704,6 @@ ieee80211_promisc(struct ieee80211vap *v { struct ieee80211com *ic = vap->iv_ic; - /* - * XXX the bridge sets PROMISC but we don't want to - * enable it on the device, discard here so all the - * drivers don't need to special-case it - */ - if (!(vap->iv_opmode == IEEE80211_M_MONITOR || - (vap->iv_opmode == IEEE80211_M_AHDEMO && - (vap->iv_caps & IEEE80211_C_TDMA) == 0))) - return; - IEEE80211_LOCK_ASSERT(ic); if (on) { Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Thu Apr 21 05:24:47 2016 (r298388) +++ head/sys/net80211/ieee80211_ioctl.c Thu Apr 21 05:47:47 2016 (r298389) @@ -3306,11 +3306,27 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon switch (cmd) { case SIOCSIFFLAGS: IEEE80211_LOCK(ic); - if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_PROMISC) - ieee80211_promisc(vap, ifp->if_flags & IFF_PROMISC); - if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_ALLMULTI) + if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_PROMISC) { + /* + * Enable promiscuous mode when: + * 1. Interface is not a member of bridge, or + * 2. Requested by user, or + * 3. In monitor (or adhoc-demo) mode. + */ + if (ifp->if_bridge == NULL || + (ifp->if_flags & IFF_PPROMISC) != 0 || + vap->iv_opmode == IEEE80211_M_MONITOR || + (vap->iv_opmode == IEEE80211_M_AHDEMO && + (vap->iv_caps & IEEE80211_C_TDMA) == 0)) { + ieee80211_promisc(vap, + ifp->if_flags & IFF_PROMISC); + vap->iv_ifflags ^= IFF_PROMISC; + } + } + if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_ALLMULTI) { ieee80211_allmulti(vap, ifp->if_flags & IFF_ALLMULTI); - vap->iv_ifflags = ifp->if_flags; + vap->iv_ifflags ^= IFF_ALLMULTI; + } if (ifp->if_flags & IFF_UP) { /* * Bring ourself up unless we're already operational.