aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/wi/if_wi.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2002-08-21 05:57:37 +0000
committerWarner Losh <imp@FreeBSD.org>2002-08-21 05:57:37 +0000
commit34c947d8b6b6aa4e02ac77634cbe8c4a35848519 (patch)
tree83bdca7c2e10f208985d7db4f3e438d327662405 /sys/dev/wi/if_wi.c
parent87c397af5cddd58ef4a62066151d7c0e2264fc50 (diff)
downloadsrc-34c947d8b6b6aa4e02ac77634cbe8c4a35848519.tar.gz
src-34c947d8b6b6aa4e02ac77634cbe8c4a35848519.zip
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)
Notes
Notes: svn path=/head/; revision=102208
Diffstat (limited to 'sys/dev/wi/if_wi.c')
-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 22a532234cd1..1c00a6bf6f16 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: