diff options
author | zf162725 <none@none> | 2007-10-22 01:31:09 -0700 |
---|---|---|
committer | zf162725 <none@none> | 2007-10-22 01:31:09 -0700 |
commit | 3a1a8936dac0ebe7e956fa122b0b0d15e62d4108 (patch) | |
tree | 3de0659c108651dca8b3451b97d456e4b868a0ad | |
parent | 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd (diff) | |
download | illumos-joyent-3a1a8936dac0ebe7e956fa122b0b0d15e62d4108.tar.gz |
6600122 Intel 3945 A/B/G WPA Support
6609323 Ral Driver (Ralink RT2500) WPA Support
6615675 net80211 should support software TKIP
6615677 memory leak in wpi driver when AP security mode changed
6617325 dladm show-wifi status is wrong when WPA key is incorrect.
-rw-r--r-- | usr/src/uts/common/io/net80211/net80211.c | 28 | ||||
-rw-r--r-- | usr/src/uts/common/io/net80211/net80211_crypto.c | 7 | ||||
-rw-r--r-- | usr/src/uts/common/io/net80211/net80211_crypto_tkip.c | 533 | ||||
-rw-r--r-- | usr/src/uts/common/io/net80211/net80211_ioctl.c | 28 | ||||
-rw-r--r-- | usr/src/uts/common/io/net80211/net80211_node.c | 5 | ||||
-rw-r--r-- | usr/src/uts/common/io/ral/rt2560.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/wpi/wpi.c | 108 | ||||
-rw-r--r-- | usr/src/uts/common/io/wpi/wpireg.h | 6 | ||||
-rw-r--r-- | usr/src/uts/common/sys/net80211.h | 1 |
9 files changed, 665 insertions, 57 deletions
diff --git a/usr/src/uts/common/io/net80211/net80211.c b/usr/src/uts/common/io/net80211/net80211.c index bdeacc4561..ecd1911665 100644 --- a/usr/src/uts/common/io/net80211/net80211.c +++ b/usr/src/uts/common/io/net80211/net80211.c @@ -195,6 +195,16 @@ ieee80211_notify(ieee80211com_t *ic, wpa_event_type event) } /* + * Register WPA door + */ +void +ieee80211_register_door(ieee80211com_t *ic, const char *drvname, int inst) +{ + (void) snprintf(ic->ic_wpadoor, MAX_IEEE80211STR, "%s_%s%d", + WPA_DOOR, drvname, inst); +} + +/* * Default reset method for use with the ioctl support. This * method is invoked after any state change in the 802.11 * layer that should be propagated to the hardware but not @@ -223,7 +233,7 @@ ieee80211_chan2ieee(ieee80211com_t *ic, struct ieee80211_channel *ch) return (IEEE80211_CHAN_ANY); } else if (ch != NULL) { ieee80211_err("invalid channel freq %u flags %x\n", - ch->ich_freq, ch->ich_flags); + ch->ich_freq, ch->ich_flags); return (0); } ieee80211_err("invalid channel (NULL)\n"); /* ch == NULL */ @@ -293,7 +303,7 @@ ieee80211_start_watchdog(ieee80211com_t *ic, uint32_t timer) { if (ic->ic_watchdog_timer == 0 && ic->ic_watchdog != NULL) { ic->ic_watchdog_timer = timeout(ic->ic_watchdog, ic, - drv_usectohz(1000000 * timer)); + drv_usectohz(1000000 * timer)); } } @@ -380,7 +390,7 @@ ieee80211_setmode(ieee80211com_t *ic, enum ieee80211_phymode mode) /* validate new mode */ if ((ic->ic_modecaps & (1 << mode)) == 0) { ieee80211_err("ieee80211_setmode(): mode %u not supported" - " (caps 0x%x)\n", mode, ic->ic_modecaps); + " (caps 0x%x)\n", mode, ic->ic_modecaps); return (EINVAL); } @@ -411,7 +421,7 @@ ieee80211_setmode(ieee80211com_t *ic, enum ieee80211_phymode mode) } if (achannels == 0) { ieee80211_err("ieee80211_setmode(): " - "no channel found for mode %u\n", mode); + "no channel found for mode %u\n", mode); return (EINVAL); } @@ -501,7 +511,7 @@ ieee80211_hdrspace(const void *data) /* NB: we don't handle control frames */ ASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != - IEEE80211_FC0_TYPE_CTL); + IEEE80211_FC0_TYPE_CTL); if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) size += IEEE80211_ADDR_LEN; @@ -527,7 +537,7 @@ ieee80211_getmgtframe(uint8_t **frm, int pktlen) mp->b_wptr = mp->b_rptr + len; } else { ieee80211_err("ieee80211_getmgtframe: " - "alloc frame failed, %d\n", len); + "alloc frame failed, %d\n", len); } return (mp); } @@ -646,8 +656,8 @@ ieee80211_attach(ieee80211com_t *ic) /* Verify driver passed us valid data */ if (i != ieee80211_chan2ieee(ic, ch)) { ieee80211_err("bad channel ignored: " - "freq %u flags%x number %u\n", - ch->ich_freq, ch->ich_flags, i); + "freq %u flags%x number %u\n", + ch->ich_freq, ch->ich_flags, i); ch->ich_flags = 0; continue; } @@ -714,7 +724,7 @@ ieee80211_detach(ieee80211com_t *ic) static struct modlmisc i_wifi_modlmisc = { &mod_miscops, - "IEEE80211 Kernel Module v1.2" + "IEEE80211 Kernel Module v1.3" }; static struct modlinkage i_wifi_modlinkage = { diff --git a/usr/src/uts/common/io/net80211/net80211_crypto.c b/usr/src/uts/common/io/net80211/net80211_crypto.c index 6bef92705e..978be371c7 100644 --- a/usr/src/uts/common/io/net80211/net80211_crypto.c +++ b/usr/src/uts/common/io/net80211/net80211_crypto.c @@ -42,6 +42,8 @@ */ #include <sys/types.h> #include <sys/note.h> +#include <sys/crypto/common.h> +#include <sys/crypto/api.h> #include "net80211_impl.h" extern const struct ieee80211_cipher wep; @@ -436,7 +438,6 @@ ieee80211_crypto_decap(ieee80211com_t *ic, mblk_t *mp, int hdrlen) return ((cip->ic_decap)(k, mp, hdrlen) ? k : NULL); } - /* * Setup crypto support. */ @@ -446,6 +447,10 @@ ieee80211_crypto_attach(ieee80211com_t *ic) struct ieee80211_crypto_state *cs = &ic->ic_crypto; int i; + (void) crypto_mech2id(SUN_CKM_RC4); /* Load RC4 */ + (void) crypto_mech2id(SUN_CKM_AES_CBC); /* Load AES-CBC */ + (void) crypto_mech2id(SUN_CKM_AES_CCM); /* Load AES-CCM */ + /* NB: we assume everything is pre-zero'd */ cs->cs_def_txkey = IEEE80211_KEYIX_NONE; for (i = 0; i < IEEE80211_WEP_NKID; i++) { diff --git a/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c b/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c index f900d01d29..be28369a3b 100644 --- a/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c +++ b/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c @@ -35,11 +35,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * IEEE 802.11i TKIP crypto support. + * + * Part of this module is derived from similar code in the Host + * AP driver. The code is used with the consent of the author and + * it's license is included below. */ + +#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/byteorder.h> #include <sys/crypto/common.h> #include <sys/crypto/api.h> @@ -82,6 +87,17 @@ struct tkip_ctx { uint64_t rx_rsc; /* held until MIC verified */ }; +static void michael_mic(struct tkip_ctx *, const uint8_t *, + mblk_t *, uint_t, size_t, uint8_t[]); +static int tkip_encrypt(struct tkip_ctx *, struct ieee80211_key *, + mblk_t *, int); +static int tkip_decrypt(struct tkip_ctx *, struct ieee80211_key *, + mblk_t *, int); + +extern int rc4_init(crypto_context_t *, const uint8_t *, int); +extern int rc4_crypt(crypto_context_t, const uint8_t *, uint8_t *, int); +extern int rc4_final(crypto_context_t, uint8_t *, int); + /* ARGSUSED */ static void * tkip_attach(struct ieee80211com *ic, struct ieee80211_key *k) @@ -149,11 +165,12 @@ tkip_encap(struct ieee80211_key *k, mblk_t *mp, uint8_t keyid) ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ /* - * NB: software TKIP is not supported. + * Finally, do software encrypt if neeed. */ - if (k->wk_flags & IEEE80211_KEY_SWCRYPT) - return (0); - else + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + if (!tkip_encrypt(ctx, k, mp, hdrlen)) + return (0); + } else k->wk_keytsc++; /* wrap at 48 bits */ return (1); @@ -214,10 +231,14 @@ tkip_decap(struct ieee80211_key *k, mblk_t *mp, int hdrlen) */ /* - * NB: software TKIP is not supported. + * Check if the device handled the decrypt in hardware. + * If so we just strip the header; otherwise we need to + * handle the decrypt in software. */ - if (k->wk_flags & IEEE80211_KEY_SWCRYPT) - return (0); + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + if (!tkip_decrypt(ctx, k, mp, hdrlen)) + return (0); + } /* * Copy up 802.11 header and strip crypto bits. @@ -233,10 +254,27 @@ tkip_decap(struct ieee80211_key *k, mblk_t *mp, int hdrlen) /* * Add MIC to the frame as needed. */ -/* ARGSUSED */ static int tkip_enmic(struct ieee80211_key *k, mblk_t *mp, int force) { + struct tkip_ctx *ctx = k->wk_private; + + if (force || (k->wk_flags & IEEE80211_KEY_SWMIC)) { + int hdrlen; + uint8_t *mic; + + hdrlen = ieee80211_hdrspace(mp->b_rptr); + mic = mp->b_wptr; + mp->b_wptr += tkip.ic_miclen; + + if ((int)((mp->b_wptr - mp->b_rptr) + - (hdrlen + tkip.ic_header + tkip.ic_miclen)) < 0) + return (0); /* dead packet */ + + michael_mic(ctx, k->wk_txmic, mp, (hdrlen + tkip.ic_header), + (mp->b_wptr - mp->b_rptr) + - (hdrlen + tkip.ic_header + tkip.ic_miclen), mic); + } return (1); } @@ -249,11 +287,22 @@ tkip_demic(struct ieee80211_key *k, mblk_t *mp, int force) { struct tkip_ctx *ctx = k->wk_private; - /* - * NB: software TKIP is not supported. - */ - if (k->wk_flags & IEEE80211_KEY_SWMIC) - return (0); + if (force || (k->wk_flags & IEEE80211_KEY_SWMIC)) { + int hdrlen = ieee80211_hdrspace(mp->b_rptr); + uint8_t mic[IEEE80211_WEP_MICLEN]; + uint8_t mic0[IEEE80211_WEP_MICLEN]; + + michael_mic(ctx, k->wk_rxmic, + mp, hdrlen, + (mp->b_wptr - mp->b_rptr) - (hdrlen + tkip.ic_miclen), + mic); + bcopy(mp->b_wptr - tkip.ic_miclen, mic0, tkip.ic_miclen); + if (bcmp(mic, mic0, tkip.ic_miclen)) { + ieee80211_dbg(IEEE80211_MSG_CRYPTO, + "tkip_demic() mic mismatch\n"); + return (0); + } + } /* * Strip MIC from the tail. */ @@ -262,6 +311,460 @@ tkip_demic(struct ieee80211_key *k, mblk_t *mp, int force) * Ok to update rsc now that MIC has been verified. */ k->wk_keyrsc = ctx->rx_rsc; + return (1); +} + +/* + * For the avoidance of doubt, except that if any license choice other + * than GPL or LGPL is available it will apply instead, Sun elects to + * use only the General Public License version 2 (GPLv2) at this time + * for any software where a choice of GPL license versions is made + * available with the language indicating that GPLv2 or any later + * version may be used, or where a choice of which version of the GPL + * is applied is otherwise unspecified. + */ + +/* + * Host AP crypt: host-based TKIP encryption implementation for Host AP driver + * + * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + */ + +/* Table of CRCs of all 8-bit messages */ +static uint32_t crc_table[] = { CRC32_TABLE }; + +static uint16_t +RotR1(uint16_t val) +{ + return ((val >> 1) | (val << 15)); +} + +static uint8_t +Lo8(uint16_t val) +{ + return (val & 0xff); +} + +static uint8_t +Hi8(uint16_t val) +{ + return (val >> 8); +} + +static uint16_t +Lo16(uint32_t val) +{ + return (val & 0xffff); +} + +static uint16_t +Hi16(uint32_t val) +{ + return (val >> 16); +} + +static uint16_t +Mk16(uint8_t hi, uint8_t lo) +{ + return (lo | (((uint16_t)hi) << 8)); +} + +static uint16_t +Mk16_le(const uint16_t *v) +{ + return (LE_16(*v)); +} + +static const uint16_t Sbox[256] = { + 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, + 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, + 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, + 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, + 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, + 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, + 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, + 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, + 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, + 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, + 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, + 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, + 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, + 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, + 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, + 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, + 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, + 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, + 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, + 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, + 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, + 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, + 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, + 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, + 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, + 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, + 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, + 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, + 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, + 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, + 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, + 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, +}; + +static uint16_t +_S_(uint16_t v) +{ + uint16_t t = Sbox[Hi8(v)]; + return (Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8))); +} + +#define PHASE1_LOOP_COUNT 8 + +static void +tkip_mixing_phase1(uint16_t *TTAK, const uint8_t *TK, + const uint8_t *TA, uint32_t IV32) +{ + int i, j; + + /* Initialize the 80-bit TTAK from TSC (IV32) and TA[0..5] */ + TTAK[0] = Lo16(IV32); + TTAK[1] = Hi16(IV32); + TTAK[2] = Mk16(TA[1], TA[0]); + TTAK[3] = Mk16(TA[3], TA[2]); + TTAK[4] = Mk16(TA[5], TA[4]); + + for (i = 0; i < PHASE1_LOOP_COUNT; i++) { + j = 2 * (i & 1); + TTAK[0] += _S_(TTAK[4] ^ Mk16(TK[1 + j], TK[0 + j])); + TTAK[1] += _S_(TTAK[0] ^ Mk16(TK[5 + j], TK[4 + j])); + TTAK[2] += _S_(TTAK[1] ^ Mk16(TK[9 + j], TK[8 + j])); + TTAK[3] += _S_(TTAK[2] ^ Mk16(TK[13 + j], TK[12 + j])); + TTAK[4] += _S_(TTAK[3] ^ Mk16(TK[1 + j], TK[0 + j])) + i; + } +} + +static void +tkip_mixing_phase2(uint8_t *WEPSeed, const uint8_t *TK, + const uint16_t *TTAK, uint16_t IV16) +{ + /* + * Make temporary area overlap WEP seed so that the final copy can be + * avoided on little endian hosts. + */ + uint16_t *PPK = (uint16_t *)&WEPSeed[4]; + + /* Step 1 - make copy of TTAK and bring in TSC */ + PPK[0] = TTAK[0]; + PPK[1] = TTAK[1]; + PPK[2] = TTAK[2]; + PPK[3] = TTAK[3]; + PPK[4] = TTAK[4]; + PPK[5] = TTAK[4] + IV16; + + /* Step 2 - 96-bit bijective mixing using S-box */ + PPK[0] += _S_(PPK[5] ^ Mk16_le((const uint16_t *) &TK[0])); + PPK[1] += _S_(PPK[0] ^ Mk16_le((const uint16_t *) &TK[2])); + PPK[2] += _S_(PPK[1] ^ Mk16_le((const uint16_t *) &TK[4])); + PPK[3] += _S_(PPK[2] ^ Mk16_le((const uint16_t *) &TK[6])); + PPK[4] += _S_(PPK[3] ^ Mk16_le((const uint16_t *) &TK[8])); + PPK[5] += _S_(PPK[4] ^ Mk16_le((const uint16_t *) &TK[10])); + + PPK[0] += RotR1(PPK[5] ^ Mk16_le((const uint16_t *) &TK[12])); + PPK[1] += RotR1(PPK[0] ^ Mk16_le((const uint16_t *) &TK[14])); + PPK[2] += RotR1(PPK[1]); + PPK[3] += RotR1(PPK[2]); + PPK[4] += RotR1(PPK[3]); + PPK[5] += RotR1(PPK[4]); + + /* + * Step 3 - bring in last of TK bits, assign 24-bit WEP IV value + * WEPSeed[0..2] is transmitted as WEP IV + */ + WEPSeed[0] = Hi8(IV16); + WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; + WEPSeed[2] = Lo8(IV16); + WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((const uint16_t *) &TK[0])) >> 1); +} + +static int +wep_encrypt(uint8_t *key, mblk_t *mp, uint_t off, size_t data_len, + uint8_t icv[IEEE80211_WEP_CRCLEN]) +{ + uint8_t crcbuf[IEEE80211_WEP_CRCLEN]; + uint32_t crc; + crypto_context_t ctx; + int rv; + + ctx = NULL; + rv = rc4_init(&ctx, (const uint8_t *)key, 16); + if (rv != CRYPTO_SUCCESS) + return (0); + + /* calculate CRC over unencrypted data */ + CRC32(crc, mp->b_rptr + off, data_len, -1U, crc_table); + + /* encrypt data */ + (void) rc4_crypt(ctx, mp->b_rptr + off, mp->b_rptr + off, data_len); + + /* tack on ICV */ + *(uint32_t *)crcbuf = LE_32(~crc); + (void) rc4_crypt(ctx, crcbuf, icv, IEEE80211_WEP_CRCLEN); + + (void) rc4_final(ctx, icv, IEEE80211_WEP_CRCLEN); + + return (1); +} + +static int +wep_decrypt(uint8_t *key, mblk_t *mp, uint_t off, size_t data_len) +{ + uint8_t crcbuf[IEEE80211_WEP_CRCLEN]; + uint8_t *icv; + uint32_t crc; + crypto_context_t ctx; + int rv; + + ctx = NULL; + rv = rc4_init(&ctx, (const uint8_t *)key, 16); + if (rv != CRYPTO_SUCCESS) + return (0); + + /* decrypt data */ + (void) rc4_crypt(ctx, mp->b_rptr + off, mp->b_rptr + off, data_len); + + /* calculate CRC over unencrypted data */ + CRC32(crc, mp->b_rptr + off, data_len, -1U, crc_table); + + /* decrypt ICV and compare to CRC */ + icv = mp->b_wptr - IEEE80211_WEP_CRCLEN; + (void) rc4_crypt(ctx, icv, crcbuf, IEEE80211_WEP_CRCLEN); + (void) rc4_final(ctx, crcbuf, IEEE80211_WEP_CRCLEN); + + return (crc == ~LE_32(*(uint32_t *)crcbuf)); +} + +static uint32_t +rotl(uint32_t val, int bits) +{ + return ((val << bits) | (val >> (32 - bits))); +} + + +static uint32_t +rotr(uint32_t val, int bits) +{ + return ((val >> bits) | (val << (32 - bits))); +} + + +static uint32_t +xswap(uint32_t val) +{ + return (((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8)); +} + + +#define michael_block(l, r) \ +do { \ + r ^= rotl(l, 17); \ + l += r; \ + r ^= xswap(l); \ + l += r; \ + r ^= rotl(l, 3); \ + l += r; \ + r ^= rotr(l, 2); \ + l += r; \ + _NOTE(CONSTANTCONDITION)\ +} while (0) + + +static uint32_t +get_le32_split(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3) +{ + return (b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)); +} + +static uint32_t +get_le32(const uint8_t *p) +{ + return (get_le32_split(p[0], p[1], p[2], p[3])); +} + + +static void +put_le32(uint8_t *p, uint32_t v) +{ + p[0] = (uint8_t)v; + p[1] = v >> 8; + p[2] = v >> 16; + p[3] = v >> 24; +} +/* + * Craft pseudo header used to calculate the MIC. + */ +static void +michael_mic_hdr(const struct ieee80211_frame *wh0, uint8_t hdr[16]) +{ + const struct ieee80211_frame_addr4 *wh = + (const struct ieee80211_frame_addr4 *)wh0; + + switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) { + case IEEE80211_FC1_DIR_NODS: + IEEE80211_ADDR_COPY(hdr, wh->i_addr1); /* DA */ + IEEE80211_ADDR_COPY(hdr + IEEE80211_ADDR_LEN, wh->i_addr2); + break; + case IEEE80211_FC1_DIR_TODS: + IEEE80211_ADDR_COPY(hdr, wh->i_addr3); /* DA */ + IEEE80211_ADDR_COPY(hdr + IEEE80211_ADDR_LEN, wh->i_addr2); + break; + case IEEE80211_FC1_DIR_FROMDS: + IEEE80211_ADDR_COPY(hdr, wh->i_addr1); /* DA */ + IEEE80211_ADDR_COPY(hdr + IEEE80211_ADDR_LEN, wh->i_addr3); + break; + case IEEE80211_FC1_DIR_DSTODS: + IEEE80211_ADDR_COPY(hdr, wh->i_addr3); /* DA */ + IEEE80211_ADDR_COPY(hdr + IEEE80211_ADDR_LEN, wh->i_addr4); + break; + } + + hdr[12] = 0; /* QoS not supported */ + hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ +} + +/* ARGSUSED */ +static void +michael_mic(struct tkip_ctx *ctx, const uint8_t *key, + mblk_t *mp, uint_t off, size_t data_len, + uint8_t mic[IEEE80211_WEP_MICLEN]) +{ + uint8_t hdr[16]; + uint32_t l, r; + const uint8_t *data; + int i, blocks, last; + + michael_mic_hdr((struct ieee80211_frame *)mp->b_rptr, hdr); + + l = get_le32(key); + r = get_le32(key + 4); + + /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ + l ^= get_le32(hdr); + michael_block(l, r); + l ^= get_le32(&hdr[4]); + michael_block(l, r); + l ^= get_le32(&hdr[8]); + michael_block(l, r); + l ^= get_le32(&hdr[12]); + michael_block(l, r); + + /* first buffer has special handling */ + data = mp->b_rptr + off; + + blocks = data_len / 4; + last = data_len % 4; + + for (i = 0; i < blocks; i++) { + l ^= get_le32(&data[4 * i]); + michael_block(l, r); + } + + /* Last block and padding (0x5a, 4..7 x 0) */ + switch (last) { + case 0: + l ^= 0x5a; + break; + case 1: + l ^= data[4 * i] | 0x5a00; + break; + case 2: + l ^= data[4 * i] | (data[4 * i + 1] << 8) | 0x5a0000; + break; + case 3: + l ^= data[4 * i] | (data[4 * i + 1] << 8) | + (data[4 * i + 2] << 16) | 0x5a000000; + break; + } + michael_block(l, r); + /* l ^= 0; */ + michael_block(l, r); + + put_le32(mic, l); + put_le32(mic + 4, r); +} + +static int +tkip_encrypt(struct tkip_ctx *ctx, struct ieee80211_key *key, + mblk_t *mp, int hdrlen) +{ + struct ieee80211_frame *wh; + uint8_t *icv; + + wh = (struct ieee80211_frame *)mp->b_rptr; + if (!ctx->tx_phase1_done) { + tkip_mixing_phase1(ctx->tx_ttak, key->wk_key, wh->i_addr2, + (uint32_t)(key->wk_keytsc >> 16)); + ctx->tx_phase1_done = 1; + } + tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak, + (uint16_t)key->wk_keytsc); + + icv = mp->b_wptr; + mp->b_wptr += tkip.ic_trailer; + + (void) wep_encrypt(ctx->tx_rc4key, + mp, hdrlen + tkip.ic_header, + (mp->b_wptr - mp->b_rptr) + - (hdrlen + tkip.ic_header + tkip.ic_trailer), + icv); + + key->wk_keytsc++; + if ((uint16_t)(key->wk_keytsc) == 0) + ctx->tx_phase1_done = 0; + return (1); +} + +static int +tkip_decrypt(struct tkip_ctx *ctx, struct ieee80211_key *key, + mblk_t *mp, int hdrlen) +{ + struct ieee80211_frame *wh; + uint32_t iv32; + uint16_t iv16; + + wh = (struct ieee80211_frame *)mp->b_rptr; + /* tkip_decap already verified header and left seq in rx_rsc */ + iv16 = (uint16_t)ctx->rx_rsc; + iv32 = (uint32_t)(ctx->rx_rsc >> 16); + + if (iv32 != (uint32_t)(key->wk_keyrsc >> 16) || !ctx->rx_phase1_done) { + tkip_mixing_phase1(ctx->rx_ttak, key->wk_key, + wh->i_addr2, iv32); + ctx->rx_phase1_done = 0; /* DHCP */ + } + tkip_mixing_phase2(ctx->rx_rc4key, key->wk_key, ctx->rx_ttak, iv16); + + /* m is unstripped; deduct headers + ICV to get payload */ + if (!wep_decrypt(ctx->rx_rc4key, + mp, hdrlen + tkip.ic_header, + (mp->b_wptr - mp->b_rptr) + - (hdrlen + tkip.ic_header + tkip.ic_trailer))) { + if (iv32 != (uint32_t)(key->wk_keyrsc >> 16)) { + /* + * Previously cached Phase1 result was already lost, so + * it needs to be recalculated for the next packet. + */ + ctx->rx_phase1_done = 0; + } + ieee80211_dbg(IEEE80211_MSG_CRYPTO, "tkip_decrypt() error\n"); + return (0); + } return (1); } diff --git a/usr/src/uts/common/io/net80211/net80211_ioctl.c b/usr/src/uts/common/io/net80211/net80211_ioctl.c index 6479ab998e..3bd4ba29cc 100644 --- a/usr/src/uts/common/io/net80211/net80211_ioctl.c +++ b/usr/src/uts/common/io/net80211/net80211_ioctl.c @@ -473,7 +473,7 @@ wifi_cfg_keyid(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) switch (cmd) { case WLAN_GET_PARAM: *ow_kid = (ic->ic_def_txkey == IEEE80211_KEYIX_NONE) ? - 0 : ic->ic_def_txkey; + 0 : ic->ic_def_txkey; break; case WLAN_SET_PARAM: if (*iw_kid >= MAX_NWEPKEYS) { @@ -687,6 +687,10 @@ wifi_cfg_linkstatus(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) case WLAN_GET_PARAM: *ow_linkstat = (ic->ic_state == IEEE80211_S_RUN) ? WL_CONNECTED : WL_NOTCONNECTED; + if ((ic->ic_flags & IEEE80211_F_WPA) && + (ieee80211_crypto_getciphertype(ic) != WIFI_SEC_WPA)) { + *ow_linkstat = WL_NOTCONNECTED; + } break; case WLAN_SET_PARAM: outp->wldp_result = WL_READONLY; @@ -717,7 +721,7 @@ wifi_cfg_suprates(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) err = 0; /* rate value (wl_rates_rates) is of type char */ buflen = offsetof(wl_rates_t, wl_rates_rates) + - sizeof (char) * IEEE80211_MODE_MAX * IEEE80211_RATE_MAXSIZE; + sizeof (char) * IEEE80211_MODE_MAX * IEEE80211_RATE_MAXSIZE; if ((omp = wifi_getoutmsg(*mp, cmd, buflen)) == NULL) return (ENOMEM); outp = (wldp_t *)omp->b_rptr; @@ -791,8 +795,8 @@ wifi_cfg_desrates(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) case WLAN_GET_PARAM: ow_rates->wl_rates_num = 1; ow_rates->wl_rates_rates[0] = - (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) ? - srate : ic->ic_fixed_rate; + (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) ? + srate : ic->ic_fixed_rate; break; case WLAN_SET_PARAM: drate = iw_rates->wl_rates_rates[0]; @@ -975,7 +979,7 @@ wifi_read_ap(void *arg, struct ieee80211_node *in) uint_t i, nrates; end = (uint8_t *)aps - WIFI_BUF_OFFSET + MAX_BUF_LEN - - sizeof (wl_ess_list_t); + sizeof (wl_ess_list_t); conf = &aps->wl_ess_list_ess[aps->wl_ess_list_num]; if ((uint8_t *)conf > end) return; @@ -1215,7 +1219,7 @@ wifi_cfg_caps(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) switch (cmd) { case WLAN_GET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_caps: " - "ic_caps = %u\n", ic->ic_caps); + "ic_caps = %u\n", ic->ic_caps); o_caps->caps = ic->ic_caps; break; case WLAN_SET_PARAM: @@ -1255,12 +1259,12 @@ wifi_cfg_wpa(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) switch (cmd) { case WLAN_GET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_wpa: " - "get wpa=%u\n", wpa->wpa_flag); + "get wpa=%u\n", wpa->wpa_flag); o_wpa->wpa_flag = ((ic->ic_flags & IEEE80211_F_WPA)? 1 : 0); break; case WLAN_SET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_wpa: " - "set wpa=%u\n", wpa->wpa_flag); + "set wpa=%u\n", wpa->wpa_flag); if (wpa->wpa_flag > 0) { /* enable WPA mode */ ic->ic_flags |= IEEE80211_F_PRIVACY; ic->ic_flags |= IEEE80211_F_WPA; @@ -1308,7 +1312,7 @@ wifi_cfg_wpakey(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) break; case WLAN_SET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_wpakey: " - "idx=%d\n", ik->ik_keyix); + "idx=%d\n", ik->ik_keyix); /* NB: cipher support is verified by ieee80211_crypt_newkey */ /* NB: this also checks ik->ik_keylen > sizeof(wk->wk_key) */ if (ik->ik_keylen > sizeof (ik->ik_keydata)) { @@ -1338,7 +1342,7 @@ wifi_cfg_wpakey(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) KEY_UPDATE_BEGIN(ic); if (ieee80211_crypto_newkey(ic, ik->ik_type, - ik->ik_flags, wk)) { + ik->ik_flags, wk)) { wk->wk_keylen = ik->ik_keylen; /* NB: MIC presence is implied by cipher type */ if (wk->wk_keylen > IEEE80211_KEYBUF_SIZE) @@ -1401,7 +1405,7 @@ wifi_cfg_delkey(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) break; case WLAN_SET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_delkey: " - "keyix=%d\n", dk->idk_keyix); + "keyix=%d\n", dk->idk_keyix); kid = dk->idk_keyix; if (kid == IEEE80211_KEYIX_NONE || kid >= IEEE80211_WEP_NKID) { ieee80211_err("wifi_cfg_delkey: incorrect keyix\n"); @@ -1586,7 +1590,7 @@ wifi_cfg_setmlme(struct ieee80211com *ic, uint32_t cmd, mblk_t **mp) break; case WLAN_SET_PARAM: ieee80211_dbg(IEEE80211_MSG_WPA, "wifi_cfg_setmlme: " - "op=%d\n", mlme->im_op); + "op=%d\n", mlme->im_op); switch (mlme->im_op) { case IEEE80211_MLME_DISASSOC: case IEEE80211_MLME_DEAUTH: diff --git a/usr/src/uts/common/io/net80211/net80211_node.c b/usr/src/uts/common/io/net80211/net80211_node.c index dd8ad31e80..cc7e0f92ff 100644 --- a/usr/src/uts/common/io/net80211/net80211_node.c +++ b/usr/src/uts/common/io/net80211/net80211_node.c @@ -1024,8 +1024,11 @@ ieee80211_saveie(uint8_t **iep, const uint8_t *ie) static void saveie(uint8_t **iep, const uint8_t *ie) { - if (ie == NULL) + if (ie == NULL) { + if (*iep != NULL) + ieee80211_free(*iep); *iep = NULL; + } else ieee80211_saveie(iep, ie); } diff --git a/usr/src/uts/common/io/ral/rt2560.c b/usr/src/uts/common/io/ral/rt2560.c index a33f0e797e..84e7f8139e 100644 --- a/usr/src/uts/common/io/ral/rt2560.c +++ b/usr/src/uts/common/io/ral/rt2560.c @@ -2406,6 +2406,8 @@ rt2560_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) IEEE80211_C_SHPREAMBLE | /* short preamble supported */ IEEE80211_C_SHSLOT; /* short slot time supported */ + ic->ic_caps |= IEEE80211_C_WPA; /* Support WPA/WPA2 */ + #define IEEE80211_CHAN_A \ (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) @@ -2446,6 +2448,10 @@ rt2560_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd) ieee80211_attach(ic); + /* register WPA door */ + ieee80211_register_door(ic, ddi_driver_name(devinfo), + ddi_get_instance(devinfo)); + ic->ic_node_alloc = rt2560_node_alloc; ic->ic_node_free = rt2560_node_free; diff --git a/usr/src/uts/common/io/wpi/wpi.c b/usr/src/uts/common/io/wpi/wpi.c index 21767d3d33..e3195a8669 100644 --- a/usr/src/uts/common/io/wpi/wpi.c +++ b/usr/src/uts/common/io/wpi/wpi.c @@ -220,6 +220,8 @@ static void wpi_free_tx_ring(wpi_sc_t *, wpi_tx_ring_t *); static ieee80211_node_t *wpi_node_alloc(ieee80211com_t *); static void wpi_node_free(ieee80211_node_t *); static int wpi_newstate(ieee80211com_t *, enum ieee80211_state, int); +static int wpi_key_set(ieee80211com_t *, const struct ieee80211_key *, + const uint8_t mac[IEEE80211_ADDR_LEN]); static void wpi_mem_lock(wpi_sc_t *); static void wpi_mem_unlock(wpi_sc_t *); static uint32_t wpi_mem_read(wpi_sc_t *, uint16_t); @@ -507,12 +509,15 @@ wpi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ ic->ic_state = IEEE80211_S_INIT; ic->ic_maxrssi = 70; /* experimental number */ - /* - * use software WEP for the current version. - */ ic->ic_caps = IEEE80211_C_SHPREAMBLE | IEEE80211_C_TXPMGT | IEEE80211_C_PMGT | IEEE80211_C_SHSLOT; + /* + * use software WEP and TKIP, hardware CCMP; + */ + ic->ic_caps |= IEEE80211_C_AES_CCM; + ic->ic_caps |= IEEE80211_C_WPA; /* Support WPA/WPA2 */ + /* set supported .11b and .11g rates */ ic->ic_sup_rates[IEEE80211_MODE_11B] = wpi_rateset_11b; ic->ic_sup_rates[IEEE80211_MODE_11G] = wpi_rateset_11g; @@ -532,6 +537,10 @@ wpi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) */ ieee80211_attach(ic); + /* register WPA door */ + ieee80211_register_door(ic, ddi_driver_name(dip), + ddi_get_instance(dip)); + /* * Override 80211 default routines */ @@ -539,6 +548,7 @@ wpi_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) ic->ic_newstate = wpi_newstate; ic->ic_node_alloc = wpi_node_alloc; ic->ic_node_free = wpi_node_free; + ic->ic_crypto.cs_key_set = wpi_key_set; ieee80211_media_init(ic); /* * initialize default tx key @@ -1166,6 +1176,8 @@ wpi_node_free(ieee80211_node_t *in) ieee80211com_t *ic = in->in_ic; ic->ic_node_cleanup(in); + if (in->in_wpa_ie != NULL) + ieee80211_free(in->in_wpa_ie); kmem_free(in, sizeof (wpi_amrr_t)); } @@ -1275,6 +1287,59 @@ wpi_newstate(ieee80211com_t *ic, enum ieee80211_state nstate, int arg) return (sc->sc_newstate(ic, nstate, arg)); } +/*ARGSUSED*/ +static int wpi_key_set(ieee80211com_t *ic, const struct ieee80211_key *k, + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + wpi_sc_t *sc = (wpi_sc_t *)ic; + wpi_node_t node; + int err; + + switch (k->wk_cipher->ic_cipher) { + case IEEE80211_CIPHER_WEP: + case IEEE80211_CIPHER_TKIP: + return (1); /* sofeware do it. */ + case IEEE80211_CIPHER_AES_CCM: + break; + default: + return (0); + } + sc->sc_config.filter &= ~(WPI_FILTER_NODECRYPTUNI | + WPI_FILTER_NODECRYPTMUL); + + mutex_enter(&sc->sc_glock); + + /* update ap/multicast node */ + (void) memset(&node, 0, sizeof (node)); + if (IEEE80211_IS_MULTICAST(mac)) { + (void) memset(node.bssid, 0xff, 6); + node.id = WPI_ID_BROADCAST; + } else { + IEEE80211_ADDR_COPY(node.bssid, ic->ic_bss->in_bssid); + node.id = WPI_ID_BSS; + } + if (k->wk_flags & IEEE80211_KEY_XMIT) { + node.key_flags = 0; + node.keyp = k->wk_keyix; + } else { + node.key_flags = (1 << 14); + node.keyp = k->wk_keyix + 4; + } + (void) memcpy(node.key, k->wk_key, k->wk_keylen); + node.key_flags |= (2 | (1 << 3) | (k->wk_keyix << 8)); + node.sta_mask = 1; + node.control = 1; + err = wpi_cmd(sc, WPI_CMD_ADD_NODE, &node, sizeof (node), 1); + if (err != WPI_SUCCESS) { + cmn_err(CE_WARN, "wpi_key_set():" + "failed to update ap node\n"); + mutex_exit(&sc->sc_glock); + return (0); + } + mutex_exit(&sc->sc_glock); + return (1); +} + /* * Grab exclusive access to NIC memory. */ @@ -1911,6 +1976,22 @@ wpi_send(ieee80211com_t *ic, mblk_t *mp, uint8_t type) err = WPI_SUCCESS; goto exit; } + + (void) ieee80211_encap(ic, m, in); + + cmd->code = WPI_CMD_TX_DATA; + cmd->flags = 0; + cmd->qid = ring->qid; + cmd->idx = ring->cur; + + tx = (wpi_cmd_data_t *)cmd->data; + tx->flags = 0; + if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { + tx->flags |= LE_32(WPI_TX_NEED_ACK); + } else { + tx->flags &= ~(LE_32(WPI_TX_NEED_ACK)); + } + if (wh->i_fc[1] & IEEE80211_FC1_WEP) { k = ieee80211_crypto_encap(ic, m); if (k == NULL) { @@ -1920,6 +2001,12 @@ wpi_send(ieee80211com_t *ic, mblk_t *mp, uint8_t type) goto exit; } + if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_AES_CCM) { + tx->security = 2; /* for CCMP */ + tx->flags |= LE_32(WPI_TX_NEED_ACK); + (void) memcpy(&tx->key, k->wk_key, k->wk_keylen); + } + /* packet header may have moved, reset our local pointer */ wh = (struct ieee80211_frame *)m->b_rptr; } @@ -1964,19 +2051,6 @@ wpi_send(ieee80211com_t *ic, mblk_t *mp, uint8_t type) } #endif - cmd->code = WPI_CMD_TX_DATA; - cmd->flags = 0; - cmd->qid = ring->qid; - cmd->idx = ring->cur; - - tx = (wpi_cmd_data_t *)cmd->data; - tx->flags = 0; - if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - tx->flags |= LE_32(WPI_TX_NEED_ACK); - } else { - tx->flags &= ~(LE_32(WPI_TX_NEED_ACK)); - } - tx->flags |= (LE_32(WPI_TX_AUTO_SEQ)); tx->flags |= LE_32(WPI_TX_BT_DISABLE | WPI_TX_CALIBRATION); @@ -2663,7 +2737,7 @@ wpi_config(wpi_sc_t *sc) case IEEE80211_M_STA: sc->sc_config.mode = WPI_MODE_STA; sc->sc_config.filter |= LE_32(WPI_FILTER_MULTICAST | - WPI_FILTER_NODECRYPT); + WPI_FILTER_NODECRYPTUNI | WPI_FILTER_NODECRYPTMUL); break; case IEEE80211_M_IBSS: case IEEE80211_M_AHDEMO: diff --git a/usr/src/uts/common/io/wpi/wpireg.h b/usr/src/uts/common/io/wpi/wpireg.h index eccdbae1e0..2777f54101 100644 --- a/usr/src/uts/common/io/wpi/wpireg.h +++ b/usr/src/uts/common/io/wpi/wpireg.h @@ -337,7 +337,8 @@ typedef struct wpi_config { #define WPI_FILTER_PROMISC (1 << 0) #define WPI_FILTER_CTL (1 << 1) #define WPI_FILTER_MULTICAST (1 << 2) -#define WPI_FILTER_NODECRYPT (1 << 3) +#define WPI_FILTER_NODECRYPTUNI (1 << 3) +#define WPI_FILTER_NODECRYPTMUL (1 << 4) #define WPI_FILTER_BSS (1 << 5) #define WPI_FILTER_BEACON (1 << 6) @@ -402,7 +403,8 @@ typedef struct wpi_node { uint8_t tkip; uint8_t reserved4; uint16_t ttak[5]; - uint16_t reserved5; + uint8_t keyp; + uint8_t reserved5; uint8_t key[16]; uint32_t flags; uint32_t mask; diff --git a/usr/src/uts/common/sys/net80211.h b/usr/src/uts/common/sys/net80211.h index 38efb4b3ed..27bc20522a 100644 --- a/usr/src/uts/common/sys/net80211.h +++ b/usr/src/uts/common/sys/net80211.h @@ -471,6 +471,7 @@ void ieee80211_attach(ieee80211com_t *); void ieee80211_detach(ieee80211com_t *); void ieee80211_media_init(ieee80211com_t *); int ieee80211_ioctl(ieee80211com_t *, queue_t *, mblk_t *); +void ieee80211_register_door(ieee80211com_t *, const char *, int); /* Protocol Processing */ int ieee80211_input(ieee80211com_t *, mblk_t *, ieee80211_node_t *, |