summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211.h
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2005-02-17 18:28:05 +0000
committerreyk <reyk@openbsd.org>2005-02-17 18:28:05 +0000
commit0fd4e251e2b98f39170f1fb8b86a06443efd45a6 (patch)
tree487310d7396933ff11a87a3983bb1349d9a7ca86 /sys/net80211/ieee80211.h
parentmiscellaneous typo fixes: (diff)
downloadwireguard-openbsd-0fd4e251e2b98f39170f1fb8b86a06443efd45a6.tar.xz
wireguard-openbsd-0fd4e251e2b98f39170f1fb8b86a06443efd45a6.zip
derived from NetBSD:
--- Make the node table into an LRU cache: least-recently used nodes are at the end of the node queue. Change the reference-counting discipline: ni->ni_refcnt indicates how many times net80211 has granted ni to the driver. Every node in the table with ni_refcnt=0 is eligible to be garbage-collected. The mere presence of a node in the table does not any longer indicate its auth/assoc state; nodes have a ni_state variable, now. While I am here, patch ieee80211_find_node_for_beacon to do a "best match" by bssid/ssid/channel, not a "perfect match." This keeps net80211 from caching duplicate nodes in the table. --- ok deraadt@ dlg@, looks good jsg@
Diffstat (limited to 'sys/net80211/ieee80211.h')
-rw-r--r--sys/net80211/ieee80211.h94
1 files changed, 82 insertions, 12 deletions
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
index a6a4c116981..92f01513b51 100644
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.h,v 1.7 2004/12/30 23:32:55 reyk Exp $ */
+/* $OpenBSD: ieee80211.h,v 1.8 2005/02/17 18:28:05 reyk Exp $ */
/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
/*-
@@ -124,6 +124,19 @@ struct ieee80211_mnf {
#define MNF_SETUP_RESP 1
#define MNF_TEARDOWN 2
+ /*
+ * WME/802.11e information element.
+ */
+struct ieee80211_ie_wme {
+ u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */
+ u_int8_t wme_len; /* length in bytes */
+ u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */
+ u_int8_t wme_type; /* OUI type */
+ u_int8_t wme_subtype; /* OUI subtype */
+ u_int8_t wme_version; /* spec revision */
+ u_int8_t wme_info; /* AC info */
+} __packed;
+
/*
* WME/802.11e Tspec Element
*/
@@ -280,7 +293,7 @@ struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
* octet information[length]
*/
-typedef uint8_t *ieee80211_mgt_beacon_t;
+typedef u_int8_t *ieee80211_mgt_beacon_t;
#define IEEE80211_BEACON_INTERVAL(beacon) \
((beacon)[8] | ((beacon)[9] << 8))
@@ -309,6 +322,8 @@ typedef uint8_t *ieee80211_mgt_beacon_t;
* 802.11i/WPA information element (maximally sized).
*/
struct ieee80211_ie_wpa {
+ u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */
+ u_int8_t wpa_len; /* length in bytes */
u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */
u_int8_t wpa_type; /* OUI type */
u_int16_t wpa_version; /* spec revision */
@@ -317,12 +332,15 @@ struct ieee80211_ie_wpa {
u_int32_t wpa_uciphers[8];/* ciphers */
u_int16_t wpa_authselcnt; /* authentication selector cnt*/
u_int32_t wpa_authsels[8];/* selectors */
+ u_int16_t wpa_caps; /* 802.11i capabilities */
+ u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */
+ u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */
} __packed;
/*
- * Management information elements
+ * Management information element payloads
*/
-struct ieee80211_information {
+union ieee80211_information {
char ssid[IEEE80211_NWID_LEN+1];
struct rates {
u_int8_t *p;
@@ -369,7 +387,6 @@ struct ieee80211_information {
struct ath {
u_int8_t flags;
} ath;
- struct ieee80211_ie_wpa wpa;
};
enum {
@@ -384,6 +401,7 @@ enum {
IEEE80211_ELEMID_CHALLENGE = 16,
/* 17-31 reserved for challenge text extension */
IEEE80211_ELEMID_ERP = 42,
+ IEEE80211_ELEMID_RSN = 48,
IEEE80211_ELEMID_XRATES = 50,
IEEE80211_ELEMID_TPC = 150,
IEEE80211_ELEMID_CCKM = 156,
@@ -426,6 +444,30 @@ enum {
#define WPA_ASE_8021X_UNSPEC 0x01
#define WPA_ASE_8021X_PSK 0x02
+#define RSN_OUI 0xac0f00
+#define RSN_OUI_VERSION 1 /* current supported version */
+
+#define RSN_CSE_NULL 0x00
+#define RSN_CSE_WEP40 0x01
+#define RSN_CSE_TKIP 0x02
+#define RSN_CSE_WRAP 0x03
+#define RSN_CSE_CCMP 0x04
+#define RSN_CSE_WEP104 0x05
+
+#define RSN_ASE_NONE 0x00
+#define RSN_ASE_8021X_UNSPEC 0x01
+#define RSN_ASE_8021X_PSK 0x02
+
+#define WME_OUI 0xf25000
+#define WME_OUI_TYPE 0x02
+#define WME_OUI_VERSION 1
+
+/* WME stream classes */
+#define WME_AC_BE 0 /* best effort */
+#define WME_AC_BK 1 /* background */
+#define WME_AC_VI 2 /* video */
+#define WME_AC_VO 3 /* voice */
+
/*
* AUTH management packets
*
@@ -517,6 +559,17 @@ enum {
IEEE80211_WEP_CRCLEN)
/*
+ * 802.11i defines an extended IV for use with non-WEP ciphers.
+ * When the EXTIV bit is set in the key id byte an additional
+ * 4 bytes immediately follow the IV for TKIP. For CCMP the
+ * EXTIV bit is likewise set but the 8 bytes represent the
+ * CCMP header rather than IV+extended-IV.
+ */
+#define IEEE80211_WEP_EXTIV 0x20
+#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
+#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
+
+/*
* Maximum acceptable MTU is:
* IEEE80211_MAX_LEN - WEP overhead - CRC -
* QoS overhead - RSN/WPA overhead
@@ -528,17 +581,28 @@ enum {
#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
+#define IEEE80211_ACK_LEN \
+ (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
#define IEEE80211_MIN_LEN \
(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
-#define IEEE80211_MAX_AID 2007
-
+/*
+ * The 802.11 spec says at most 2007 stations may be
+ * associated at once. For most AP's this is way more
+ * than is feasible so we use a default of 1800. This
+ * number may be overridden by the driver and/or by
+ * user configuration.
+ */
+#define IEEE80211_AID_MAX 2007
+#define IEEE80211_AID_DEF 1800
+
+#define IEEE80211_AID(b) ((b) &~ 0xc000)
#define IEEE80211_AID_SET(b, w) \
- ((w)[((b) & ~0xc000) / 32] |= (1 << (((b) & ~0xc000) % 32)))
+ ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_CLR(b, w) \
- ((w)[((b) & ~0xc000) / 32] &= ~(1 << (((b) & ~0xc000) % 32)))
+ ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_ISSET(b, w) \
- ((w)[((b) & ~0xc000) / 32] & (1 << (((b) & ~0xc000) % 32)))
+ ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
/*
* RTS frame length parameters. The default is specified in
@@ -588,8 +652,14 @@ struct ieee80211_duration {
enum {
IEEE80211_AUTH_NONE = 0,
- IEEE80211_AUTH_OPEN = 1,
- IEEE80211_AUTH_SHARED = 2
+ IEEE80211_AUTH_OPEN = 1, /* open */
+ IEEE80211_AUTH_SHARED = 2, /* shared-key */
+ IEEE80211_AUTH_8021X = 3, /* 802.1x */
+ IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
+ IEEE80211_AUTH_WPA = 5, /* WPA w/ 802.1x */
+ IEEE80211_AUTH_WPA_PSK = 6, /* WPA w/ preshared key */
+ IEEE80211_AUTH_WPA2 = 7, /* WPA2 w/ 802.1x */
+ IEEE80211_AUTH_WPA2_PSK = 8 /* WPA2 w/ preshared key */
};
#endif /* _NET80211_IEEE80211_H_ */