instead of hard-coding values.
for RSN IE, request space for Group Integrity Cipher Suite.
-/* $OpenBSD: ieee80211_output.c,v 1.66 2008/08/02 08:35:48 damien Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.67 2008/08/12 19:05:39 damien Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
((rs->rs_nrates > IEEE80211_RATE_SIZE) ?
2 + rs->rs_nrates - IEEE80211_RATE_SIZE : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ic->ic_bss->ni_rsnprotos & IEEE80211_PROTO_RSN)) ? 2 + 44 : 0) +
+ (ic->ic_bss->ni_rsnprotos & IEEE80211_PROTO_RSN)) ?
+ 2 + IEEE80211_RSNIE_MAXLEN : 0) +
((ic->ic_flags & IEEE80211_F_QOS) ? 2 + 18 : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ic->ic_bss->ni_rsnprotos & IEEE80211_PROTO_WPA)) ? 2 + 48 : 0));
+ (ic->ic_bss->ni_rsnprotos & IEEE80211_PROTO_WPA)) ?
+ 2 + IEEE80211_WPAIE_MAXLEN : 0));
if (m == NULL)
return NULL;
((rs->rs_nrates > IEEE80211_RATE_SIZE) ?
2 + rs->rs_nrates - IEEE80211_RATE_SIZE : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)) ? 2 + 44 : 0) +
+ (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)) ?
+ 2 + IEEE80211_RSNIE_MAXLEN : 0) +
((ic->ic_flags & IEEE80211_F_QOS) ? 2 + 1 : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ni->ni_rsnprotos & IEEE80211_PROTO_WPA)) ? 2 + 48 : 0));
+ (ni->ni_rsnprotos & IEEE80211_PROTO_WPA)) ?
+ 2 + IEEE80211_WPAIE_MAXLEN : 0));
if (m == NULL)
return NULL;
((rs->rs_nrates > IEEE80211_RATE_SIZE) ?
2 + rs->rs_nrates - IEEE80211_RATE_SIZE : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)) ? 2 + 44 : 0) +
+ (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)) ?
+ 2 + IEEE80211_RSNIE_MAXLEN : 0) +
((ic->ic_flags & IEEE80211_F_QOS) ? 2 + 18 : 0) +
(((ic->ic_flags & IEEE80211_F_RSNON) &&
- (ni->ni_rsnprotos & IEEE80211_PROTO_WPA)) ? 2 + 48 : 0));
+ (ni->ni_rsnprotos & IEEE80211_PROTO_WPA)) ?
+ 2 + IEEE80211_WPAIE_MAXLEN : 0));
if (m == NULL)
return NULL;
-/* $OpenBSD: ieee80211_pae_output.c,v 1.7 2008/08/12 18:25:40 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_output.c,v 1.8 2008/08/12 19:05:39 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
k = &ic->ic_nw_keys[ic->ic_def_txkey];
m = ieee80211_get_eapol_key(M_DONTWAIT, MT_DATA,
- 2 + 48 +
- ((ni->ni_rsnprotos == IEEE80211_PROTO_RSN) ?
- 2 + 6 + k->k_len : 0) +
- ((ni->ni_flags & IEEE80211_NODE_MFP) ? 2 + 28 : 0) +
- 15);
+ ((ni->ni_rsnprotos == IEEE80211_PROTO_WPA) ?
+ 2 + IEEE80211_WPAIE_MAXLEN :
+ 2 + IEEE80211_RSNIE_MAXLEN + 2 + 6 + k->k_len + 15) +
+ ((ni->ni_flags & IEEE80211_NODE_MFP) ? 2 + 28 : 0));
if (m == NULL)
return ENOMEM;
key = mtod(m, struct ieee80211_eapol_key *);
-/* $OpenBSD: ieee80211_priv.h,v 1.2 2008/07/27 14:21:15 damien Exp $ */
+/* $OpenBSD: ieee80211_priv.h,v 1.3 2008/08/12 19:05:39 damien Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
#define IEEE80211_AID_ISSET(b, w) \
((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
+#define IEEE80211_RSNIE_MAXLEN \
+ (2 + /* Version */ \
+ 4 + /* Group Data Cipher Suite */ \
+ 2 + /* Pairwise Cipher Suite Count */ \
+ 4 * 2 + /* Pairwise Cipher Suite List (max 2) */ \
+ 2 + /* AKM Suite List Count */ \
+ 4 * 4 + /* AKM Suite List (max 4) */ \
+ 2 + /* RSN Capabilities */ \
+ 2 + /* PMKID Count */ \
+ 16 * 1 + /* PMKID List (max 1) */ \
+ 4) /* 11w: Group Integrity Cipher Suite */
+
+#define IEEE80211_WPAIE_MAXLEN \
+ (4 + /* MICROSOFT_OUI */ \
+ 2 + /* Version */ \
+ 4 + /* Group Cipher Suite */ \
+ 2 + /* Pairwise Cipher Suite Count */ \
+ 4 * 2 + /* Pairwise Cipher Suite List (max 2) */ \
+ 2 + /* AKM Suite List Count */ \
+ 4 * 2) /* AKM Suite List (max 2) */
+
/* unaligned big endian access */
#define BE_READ_2(p) \
((u_int16_t) \