From 92cbcf91286cc7a5328ae6798673dcd01cab8e6f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Oct 2011 19:04:46 +0300 Subject: [PATCH] Add Extended Capability element to AssocReq for Interworking If Interworking is enabled, add Extended Capability element to (Re)Association Request frames to indicate support for Interworking. --- wpa_supplicant/sme.c | 18 ++++++++++++++++++ wpa_supplicant/wpa_supplicant.c | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 4cb5062fa..06ebb81c8 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -237,6 +237,24 @@ void sme_authenticate(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_INTERWORKING + if (wpa_s->conf->interworking) { + u8 *pos = wpa_s->sme.assoc_req_ie; + if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN) + pos += 2 + pos[1]; + os_memmove(pos + 6, pos, + wpa_s->sme.assoc_req_ie_len - + (pos - wpa_s->sme.assoc_req_ie)); + wpa_s->sme.assoc_req_ie_len += 6; + *pos++ = WLAN_EID_EXT_CAPAB; + *pos++ = 4; + *pos++ = 0x00; + *pos++ = 0x00; + *pos++ = 0x00; + *pos++ = 0x80; /* Bit 31 - Interworking */ + } +#endif /* CONFIG_INTERWORKING */ + wpa_supplicant_cancel_sched_scan(wpa_s); wpa_supplicant_cancel_scan(wpa_s); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8f499f05c..a778f3aa0 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1289,6 +1289,22 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_INTERWORKING + if (wpa_s->conf->interworking) { + u8 *pos = wpa_ie; + if (wpa_ie_len > 0 && pos[0] == WLAN_EID_RSN) + pos += 2 + pos[1]; + os_memmove(pos + 6, pos, wpa_ie_len - (pos - wpa_ie)); + wpa_ie_len += 6; + *pos++ = WLAN_EID_EXT_CAPAB; + *pos++ = 4; + *pos++ = 0x00; + *pos++ = 0x00; + *pos++ = 0x00; + *pos++ = 0x80; /* Bit 31 - Interworking */ + } +#endif /* CONFIG_INTERWORKING */ + wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL); use_crypt = 1; cipher_pairwise = cipher_suite2driver(wpa_s->pairwise_cipher);