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.
This commit is contained in:
Warner Losh 2002-08-01 07:37:52 +00:00
parent 29284d7138
commit 3d976872ed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101139

View file

@ -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);