summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-08-21 05:57:37 +0000
committerimp <imp@FreeBSD.org>2002-08-21 05:57:37 +0000
commit1696ab648fc898846013faf1b1127eb3714a9101 (patch)
tree83bdca7c2e10f208985d7db4f3e438d327662405 /sys
parent79a8222879f83fbf452fe6ce9c06c499d7897a69 (diff)
downloadFreeBSD-src-1696ab648fc898846013faf1b1127eb3714a9101.zip
FreeBSD-src-1696ab648fc898846013faf1b1127eb3714a9101.tar.gz
When setting the WI_RID_ENCRYPTION mode, we have to conditionally
set EXCLUDE_UNENCRYPTED if we're not in OPEN mode (or if we are a symbol card). Obtained from: OpenBSD (looks like a millert@ special)
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wi/if_wi.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 22a5322..1c00a6b 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -1213,7 +1213,8 @@ wi_write_record(sc, ltv)
struct wi_softc *sc;
struct wi_ltv_gen *ltv;
{
- u_int16_t *ptr;
+ uint16_t *ptr;
+ uint16_t val;
int i;
struct wi_ltv_gen p2ltv;
@@ -1239,23 +1240,31 @@ wi_write_record(sc, ltv)
case 11: p2ltv.wi_val = 8; break;
default: return EINVAL;
}
+ p2ltv.wi_val = htole16(p2ltv.wi_val);
ltv = &p2ltv;
break;
case WI_RID_ENCRYPTION:
p2ltv.wi_type = WI_RID_P2_ENCRYPTION;
p2ltv.wi_len = 2;
- if (le16toh(ltv->wi_val)) {
- p2ltv.wi_val =htole16(PRIVACY_INVOKED |
- EXCLUDE_UNENCRYPTED);
+ if (ltv->wi_val & htole16(0x01)) {
+ val = PRIVACY_INVOKED;
+ /*
+ * If using shared key WEP we must set the
+ * EXCLUDE_UNENCRYPTED bit. Symbol cards
+ * need this bit set even when not using
+ * shared key. We can't just test for
+ * IEEE80211_AUTH_SHARED since Symbol cards
+ * have 2 shared key modes.
+ */
+ if (sc->wi_authtype != IEEE80211_AUTH_OPEN ||
+ sc->sc_firmware_type == WI_SYMBOL)
+ val |= EXCLUDE_UNENCRYPTED;
+ /* TX encryption is broken in Host AP mode. */
if (sc->wi_ptype == WI_PORTTYPE_HOSTAP)
- /*
- * Disable tx encryption...
- * it's broken.
- */
- p2ltv.wi_val |= htole16(HOST_ENCRYPT);
+ val |= HOST_ENCRYPT;
} else
- p2ltv.wi_val =
- htole16(HOST_ENCRYPT | HOST_DECRYPT);
+ val = HOST_ENCRYPT | HOST_DECRYPT;
+ p2ltv.wi_val = htole16(val);
ltv = &p2ltv;
break;
case WI_RID_TX_CRYPT_KEY:
OpenPOWER on IntegriCloud