diff options
author | avos <avos@FreeBSD.org> | 2016-04-21 05:47:47 +0000 |
---|---|---|
committer | avos <avos@FreeBSD.org> | 2016-04-21 05:47:47 +0000 |
commit | ec69bc9d6cecca3751bf3a0e75de75d11355712d (patch) | |
tree | dfc147a61fa00eeba76287cf22eb9fa002dde78f /sys/net80211 | |
parent | 242400036c050d56e1e8c90a6008126874a8ca81 (diff) | |
download | FreeBSD-src-ec69bc9d6cecca3751bf3a0e75de75d11355712d.zip FreeBSD-src-ec69bc9d6cecca3751bf3a0e75de75d11355712d.tar.gz |
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
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211.c | 10 | ||||
-rw-r--r-- | sys/net80211/ieee80211_ioctl.c | 24 |
2 files changed, 20 insertions, 14 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 9816890..bb4b141 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -704,16 +704,6 @@ ieee80211_promisc(struct ieee80211vap *vap, bool on) { 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) { diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 919471a..60898bd 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -3306,11 +3306,27 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 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. |