diff options
author | imp <imp@FreeBSD.org> | 2002-07-29 15:36:22 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-07-29 15:36:22 +0000 |
commit | 6d1a782a298137f6c22a8cab35f1196992fbc834 (patch) | |
tree | b3d5e86b53ee56ef54be9292abfec31d229f433d /sys | |
parent | fb4f03d25610de0a32dd2a350951347ebeea6ace (diff) | |
download | FreeBSD-src-6d1a782a298137f6c22a8cab35f1196992fbc834.zip FreeBSD-src-6d1a782a298137f6c22a8cab35f1196992fbc834.tar.gz |
If we are in hostap mode, do not go into promisc mode. This causes
problems with the firmware and will result in a) poor performance and
b) the inability to associate certain types of cards (most notibly
cisco).
Idea obtained from OpenBSD, but I implemented it by clearing the
IFF_PROMISC flag rather than the refusing to honor it downstream.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wi/if_wi.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 3a54760..ae364fd 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1654,6 +1654,11 @@ wi_ioctl(ifp, command, data) error = ether_ioctl(ifp, command, data); break; case SIOCSIFFLAGS: + /* + * 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_UP) { if (ifp->if_flags & IFF_RUNNING && ifp->if_flags & IFF_PROMISC && @@ -1663,8 +1668,9 @@ wi_ioctl(ifp, command, data) !(ifp->if_flags & IFF_PROMISC) && sc->wi_if_flags & IFF_PROMISC) { WI_SETVAL(WI_RID_PROMISC, 0); - } else + } else { wi_init(sc); + } } else { if (ifp->if_flags & IFF_RUNNING) { wi_stop(sc); @@ -2077,6 +2083,24 @@ wi_init(xsc) (char *)&mac.wi_mac_addr, ETHER_ADDR_LEN); wi_write_record(sc, (struct wi_ltv_gen *)&mac); + /* + * Initialize promisc mode. + * Being in the Host-AP mode causes + * great deal of pain if promisc mode is set. + * Therefore we avoid confusing the firmware + * 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) + WI_SETVAL(WI_RID_PROMISC, 1); + else + WI_SETVAL(WI_RID_PROMISC, 0); + /* Configure WEP. */ if (sc->wi_has_wep) { WI_SETVAL(WI_RID_ENCRYPTION, sc->wi_use_wep); @@ -2089,12 +2113,17 @@ wi_init(xsc) * ONLY HWB3163 EVAL-CARD Firmware version * less than 0.8 variant2 * - * If promiscuous mode disable, Prism2 chip - * does not work with WEP . + * If promiscuous mode disable, Prism2 chip + * does not work with WEP. * It is under investigation for details. * (ichiro@netbsd.org) + * + * And make sure that we don't need to do it + * in hostap mode, since it interferes with + * the above hostap workaround. */ - if (sc->sc_firmware_type == WI_INTERSIL && + if (sc->wi_ptype != WI_PORTTYPE_AP && + sc->sc_firmware_type == WI_INTERSIL && sc->sc_sta_firmware_ver < 802 ) { /* firm ver < 0.8 variant 2 */ WI_SETVAL(WI_RID_PROMISC, 1); @@ -2103,13 +2132,6 @@ wi_init(xsc) } } - /* Initialize promisc mode. */ - if (ifp->if_flags & IFF_PROMISC) { - WI_SETVAL(WI_RID_PROMISC, 1); - } else { - WI_SETVAL(WI_RID_PROMISC, 0); - } - /* Set multicast filter. */ wi_setmulti(sc); |