summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-08-01 07:37:52 +0000
committerimp <imp@FreeBSD.org>2002-08-01 07:37:52 +0000
commit1f7fcdf2d9b6caef6522a5be250d368afb15d2b7 (patch)
tree7138db1840a701e91a543d6292969048532caa10
parentaeb3f4a795522887e433f8653302426b15762a2a (diff)
downloadFreeBSD-src-1f7fcdf2d9b6caef6522a5be250d368afb15d2b7.zip
FreeBSD-src-1f7fcdf2d9b6caef6522a5be250d368afb15d2b7.tar.gz
Don't set the IFF_PROMISC bit when in hostap mode like the previous
commit bogusly did. Instead, don't set PROMSIC in the hardware if we're in hostap mode. This matches more closely what openbsd did as well.
-rw-r--r--sys/dev/wi/if_wi.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index ae364fd..ba18f2e 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -1655,19 +1655,22 @@ wi_ioctl(ifp, command, data)
break;
case SIOCSIFFLAGS:
/*
- * Can't do promisc and hostap at the same time.
+ * Can't do promisc and hostap at the same time. If all that's
+ * changing is the promisc flag, try to short-circuit a call to
+ * wi_init() by just setting PROMISC in the hardware.
*/
- if (sc->wi_ptype == WI_PORTTYPE_AP)
- ifp->if_flags &= ~IFF_PROMISC;
if (ifp->if_flags & IFF_UP) {
- if (ifp->if_flags & IFF_RUNNING &&
- ifp->if_flags & IFF_PROMISC &&
- !(sc->wi_if_flags & IFF_PROMISC)) {
- WI_SETVAL(WI_RID_PROMISC, 1);
- } else if (ifp->if_flags & IFF_RUNNING &&
- !(ifp->if_flags & IFF_PROMISC) &&
- sc->wi_if_flags & IFF_PROMISC) {
- WI_SETVAL(WI_RID_PROMISC, 0);
+ if (sc->wi_ptype != WI_PORTTYPE_AP &&
+ ifp->if_flags & IFF_RUNNING) {
+ if (ifp->if_flags & IFF_PROMISC &&
+ !(sc->wi_if_flags & IFF_PROMISC)) {
+ WI_SETVAL(WI_RID_PROMISC, 1);
+ } else if (!(ifp->if_flags & IFF_PROMISC) &&
+ sc->wi_if_flags & IFF_PROMISC) {
+ WI_SETVAL(WI_RID_PROMISC, 0);
+ } else {
+ wi_init(sc);
+ }
} else {
wi_init(sc);
}
@@ -2091,12 +2094,7 @@ wi_init(xsc)
* and always reset promisc mode in Host-AP regime,
* it shows us all the packets anyway.
*/
- /*
- * Can't do promisc and hostap at the same time.
- */
- if (sc->wi_ptype == WI_PORTTYPE_AP)
- ifp->if_flags &= ~IFF_PROMISC;
- if (ifp->if_flags & IFF_PROMISC)
+ if (sc->wi_ptype != WI_PORTTYPE_AP && ifp->if_flags & IFF_PROMISC)
WI_SETVAL(WI_RID_PROMISC, 1);
else
WI_SETVAL(WI_RID_PROMISC, 0);
OpenPOWER on IntegriCloud