From 2127425434046ae2b9f02fdbbdd37cac447af19c Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 17 Oct 2017 16:24:14 +0300 Subject: [PATCH] hostapd: backport extra changes related to KRACK While these changes are not included in the advisory, upstream encourages users to merge them. See http://lists.infradead.org/pipermail/hostap/2017-October/037989.html Signed-off-by: Stijn Tintel --- ...e-against-PTK-reinstalls-in-4-way-ha.patch | 34 +++ ...-and-check-for-this-when-deriving-PT.patch | 53 +++++ ...-workaround-for-key-reinstallation-a.patch | 221 ++++++++++++++++++ ...stentcy-checks-for-PTK-component-len.patch | 100 ++++++++ ...rmation-in-supplicant-state-machine-.patch | 25 ++ .../services/hostapd/patches/300-noscan.patch | 4 +- .../patches/380-disable_ctrl_iface_mib.patch | 8 +- .../patches/390-wpa_ie_cap_workaround.patch | 4 +- .../hostapd/patches/600-ubus_support.patch | 2 +- 9 files changed, 442 insertions(+), 9 deletions(-) create mode 100644 package/network/services/hostapd/patches/008-WPA-Extra-defense-against-PTK-reinstalls-in-4-way-ha.patch create mode 100644 package/network/services/hostapd/patches/009-Clear-PMK-length-and-check-for-this-when-deriving-PT.patch create mode 100644 package/network/services/hostapd/patches/010-Optional-AP-side-workaround-for-key-reinstallation-a.patch create mode 100644 package/network/services/hostapd/patches/011-Additional-consistentcy-checks-for-PTK-component-len.patch create mode 100644 package/network/services/hostapd/patches/012-Clear-BSSID-information-in-supplicant-state-machine-.patch diff --git a/package/network/services/hostapd/patches/008-WPA-Extra-defense-against-PTK-reinstalls-in-4-way-ha.patch b/package/network/services/hostapd/patches/008-WPA-Extra-defense-against-PTK-reinstalls-in-4-way-ha.patch new file mode 100644 index 0000000000..40f6b56965 --- /dev/null +++ b/package/network/services/hostapd/patches/008-WPA-Extra-defense-against-PTK-reinstalls-in-4-way-ha.patch @@ -0,0 +1,34 @@ +From a00e946c1c9a1f9cc65c72900d2a444ceb1f872e Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Thu, 5 Oct 2017 23:53:01 +0200 +Subject: [PATCH] WPA: Extra defense against PTK reinstalls in 4-way handshake + +Currently, reinstallations of the PTK are prevented by (1) assuring the +same TPTK is only set once as the PTK, and (2) that one particular PTK +is only installed once. This patch makes it more explicit that point (1) +is required to prevent key reinstallations. At the same time, this patch +hardens wpa_supplicant such that future changes do not accidentally +break this property. + +Signed-off-by: Mathy Vanhoef +--- + src/rsn_supp/wpa.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -1728,6 +1728,14 @@ static int wpa_supplicant_verify_eapol_k + sm->ptk_set = 1; + os_memcpy(&sm->ptk, &sm->tptk, sizeof(sm->ptk)); + os_memset(&sm->tptk, 0, sizeof(sm->tptk)); ++ /* ++ * This assures the same TPTK in sm->tptk can never be ++ * copied twice to sm->pkt as the new PTK. In ++ * combination with the installed flag in the wpa_ptk ++ * struct, this assures the same PTK is only installed ++ * once. ++ */ ++ sm->renew_snonce = 1; + } + } + diff --git a/package/network/services/hostapd/patches/009-Clear-PMK-length-and-check-for-this-when-deriving-PT.patch b/package/network/services/hostapd/patches/009-Clear-PMK-length-and-check-for-this-when-deriving-PT.patch new file mode 100644 index 0000000000..ed7d79ec1b --- /dev/null +++ b/package/network/services/hostapd/patches/009-Clear-PMK-length-and-check-for-this-when-deriving-PT.patch @@ -0,0 +1,53 @@ +From b488a12948751f57871f09baa345e59b23959a41 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 8 Oct 2017 13:18:02 +0300 +Subject: [PATCH] Clear PMK length and check for this when deriving PTK + +Instead of setting the default PMK length for the cleared PMK, set the +length to 0 and explicitly check for this when deriving PTK to avoid +unexpected key derivation with an all-zeroes key should it be possible +to somehow trigger PTK derivation to happen before PMK derivation. + +Signed-off-by: Jouni Malinen +--- + src/common/wpa_common.c | 5 +++++ + src/rsn_supp/wpa.c | 7 ++++--- + 2 files changed, 9 insertions(+), 3 deletions(-) + +--- a/src/common/wpa_common.c ++++ b/src/common/wpa_common.c +@@ -225,6 +225,11 @@ int wpa_pmk_to_ptk(const u8 *pmk, size_t + u8 tmp[WPA_KCK_MAX_LEN + WPA_KEK_MAX_LEN + WPA_TK_MAX_LEN]; + size_t ptk_len; + ++ if (pmk_len == 0) { ++ wpa_printf(MSG_ERROR, "WPA: No PMK set for PT derivation"); ++ return -1; ++ } ++ + if (os_memcmp(addr1, addr2, ETH_ALEN) < 0) { + os_memcpy(data, addr1, ETH_ALEN); + os_memcpy(data + ETH_ALEN, addr2, ETH_ALEN); +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -584,7 +584,8 @@ static void wpa_supplicant_process_1_of_ + /* Calculate PTK which will be stored as a temporary PTK until it has + * been verified when processing message 3/4. */ + ptk = &sm->tptk; +- wpa_derive_ptk(sm, src_addr, key, ptk); ++ if (wpa_derive_ptk(sm, src_addr, key, ptk) < 0) ++ goto failed; + if (sm->pairwise_cipher == WPA_CIPHER_TKIP) { + u8 buf[8]; + /* Supplicant: swap tx/rx Mic keys */ +@@ -2705,8 +2706,8 @@ void wpa_sm_set_pmk_from_pmksa(struct wp + sm->pmk_len = sm->cur_pmksa->pmk_len; + os_memcpy(sm->pmk, sm->cur_pmksa->pmk, sm->pmk_len); + } else { +- sm->pmk_len = PMK_LEN; +- os_memset(sm->pmk, 0, PMK_LEN); ++ sm->pmk_len = 0; ++ os_memset(sm->pmk, 0, PMK_LEN_MAX); + } + } + diff --git a/package/network/services/hostapd/patches/010-Optional-AP-side-workaround-for-key-reinstallation-a.patch b/package/network/services/hostapd/patches/010-Optional-AP-side-workaround-for-key-reinstallation-a.patch new file mode 100644 index 0000000000..19165cce2d --- /dev/null +++ b/package/network/services/hostapd/patches/010-Optional-AP-side-workaround-for-key-reinstallation-a.patch @@ -0,0 +1,221 @@ +From 6f234c1e2ee1ede29f2412b7012b3345ed8e52d3 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Mon, 16 Oct 2017 18:37:43 +0300 +Subject: [PATCH] Optional AP side workaround for key reinstallation attacks + +This adds a new hostapd configuration parameter +wpa_disable_eapol_key_retries=1 that can be used to disable +retransmission of EAPOL-Key frames that are used to install +keys (EAPOL-Key message 3/4 and group message 1/2). This is +similar to setting wpa_group_update_count=1 and +wpa_pairwise_update_count=1, but with no impact to message 1/4 +retries and with extended timeout for messages 4/4 and group +message 2/2 to avoid causing issues with stations that may use +aggressive power saving have very long time in replying to the +EAPOL-Key messages. + +This option can be used to work around key reinstallation attacks +on the station (supplicant) side in cases those station devices +cannot be updated for some reason. By removing the +retransmissions the attacker cannot cause key reinstallation with +a delayed frame transmission. This is related to the station side +vulnerabilities CVE-2017-13077, CVE-2017-13078, CVE-2017-13079, +CVE-2017-13080, and CVE-2017-13081. + +This workaround might cause interoperability issues and reduced +robustness of key negotiation especially in environments with +heavy traffic load due to the number of attempts to perform the +key exchange is reduced significantly. As such, this workaround +is disabled by default (unless overridden in build +configuration). To enable this, set the parameter to 1. + +It is also possible to enable this in the build by default by +adding the following to the build configuration: + +CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 + +Signed-off-by: Jouni Malinen +--- + hostapd/config_file.c | 2 ++ + hostapd/defconfig | 4 ++++ + hostapd/hostapd.conf | 24 ++++++++++++++++++++++++ + src/ap/ap_config.c | 6 ++++++ + src/ap/ap_config.h | 1 + + src/ap/wpa_auth.c | 22 ++++++++++++++++++++-- + src/ap/wpa_auth.h | 1 + + src/ap/wpa_auth_glue.c | 2 ++ + 8 files changed, 60 insertions(+), 2 deletions(-) + +--- a/hostapd/config_file.c ++++ b/hostapd/config_file.c +@@ -2542,6 +2542,8 @@ static int hostapd_config_fill(struct ho + return 1; + } + bss->wpa_pairwise_update_count = (u32) val; ++ } else if (os_strcmp(buf, "wpa_disable_eapol_key_retries") == 0) { ++ bss->wpa_disable_eapol_key_retries = atoi(pos); + } else if (os_strcmp(buf, "wpa_passphrase") == 0) { + int len = os_strlen(pos); + if (len < 8 || len > 63) { +--- a/hostapd/defconfig ++++ b/hostapd/defconfig +@@ -372,3 +372,7 @@ CONFIG_IPV6=y + # Opportunistic Wireless Encryption (OWE) + # Experimental implementation of draft-harkins-owe-07.txt + #CONFIG_OWE=y ++ ++# Override default value for the wpa_disable_eapol_key_retries configuration ++# parameter. See that parameter in hostapd.conf for more details. ++#CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 +--- a/hostapd/hostapd.conf ++++ b/hostapd/hostapd.conf +@@ -1315,6 +1315,30 @@ own_ip_addr=127.0.0.1 + # Range 1..4294967295; default: 4 + #wpa_pairwise_update_count=4 + ++# Workaround for key reinstallation attacks ++# ++# This parameter can be used to disable retransmission of EAPOL-Key frames that ++# are used to install keys (EAPOL-Key message 3/4 and group message 1/2). This ++# is similar to setting wpa_group_update_count=1 and ++# wpa_pairwise_update_count=1, but with no impact to message 1/4 and with ++# extended timeout on the response to avoid causing issues with stations that ++# may use aggressive power saving have very long time in replying to the ++# EAPOL-Key messages. ++# ++# This option can be used to work around key reinstallation attacks on the ++# station (supplicant) side in cases those station devices cannot be updated ++# for some reason. By removing the retransmissions the attacker cannot cause ++# key reinstallation with a delayed frame transmission. This is related to the ++# station side vulnerabilities CVE-2017-13077, CVE-2017-13078, CVE-2017-13079, ++# CVE-2017-13080, and CVE-2017-13081. ++# ++# This workaround might cause interoperability issues and reduced robustness of ++# key negotiation especially in environments with heavy traffic load due to the ++# number of attempts to perform the key exchange is reduced significantly. As ++# such, this workaround is disabled by default (unless overridden in build ++# configuration). To enable this, set the parameter to 1. ++#wpa_disable_eapol_key_retries=1 ++ + # Enable IEEE 802.11i/RSN/WPA2 pre-authentication. This is used to speed up + # roaming be pre-authenticating IEEE 802.1X/EAP part of the full RSN + # authentication and key handshake before actually associating with a new AP. +--- a/src/ap/ap_config.c ++++ b/src/ap/ap_config.c +@@ -37,6 +37,10 @@ static void hostapd_config_free_vlan(str + } + + ++#ifndef DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES ++#define DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES 0 ++#endif /* DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES */ ++ + void hostapd_config_defaults_bss(struct hostapd_bss_config *bss) + { + dl_list_init(&bss->anqp_elem); +@@ -58,6 +62,8 @@ void hostapd_config_defaults_bss(struct + bss->wpa_gmk_rekey = 86400; + bss->wpa_group_update_count = 4; + bss->wpa_pairwise_update_count = 4; ++ bss->wpa_disable_eapol_key_retries = ++ DEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES; + bss->wpa_key_mgmt = WPA_KEY_MGMT_PSK; + bss->wpa_pairwise = WPA_CIPHER_TKIP; + bss->wpa_group = WPA_CIPHER_TKIP; +--- a/src/ap/ap_config.h ++++ b/src/ap/ap_config.h +@@ -333,6 +333,7 @@ struct hostapd_bss_config { + int wpa_ptk_rekey; + u32 wpa_group_update_count; + u32 wpa_pairwise_update_count; ++ int wpa_disable_eapol_key_retries; + int rsn_pairwise; + int rsn_preauth; + char *rsn_preauth_interfaces; +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -65,6 +65,7 @@ static u8 * ieee80211w_kde_add(struct wp + static const u32 eapol_key_timeout_first = 100; /* ms */ + static const u32 eapol_key_timeout_subseq = 1000; /* ms */ + static const u32 eapol_key_timeout_first_group = 500; /* ms */ ++static const u32 eapol_key_timeout_no_retrans = 4000; /* ms */ + + /* TODO: make these configurable */ + static const int dot11RSNAConfigPMKLifetime = 43200; +@@ -1653,6 +1654,9 @@ static void wpa_send_eapol(struct wpa_au + eapol_key_timeout_first_group; + else + timeout_ms = eapol_key_timeout_subseq; ++ if (wpa_auth->conf.wpa_disable_eapol_key_retries && ++ (!pairwise || (key_info & WPA_KEY_INFO_MIC))) ++ timeout_ms = eapol_key_timeout_no_retrans; + if (pairwise && ctr == 1 && !(key_info & WPA_KEY_INFO_MIC)) + sm->pending_1_of_4_timeout = 1; + wpa_printf(MSG_DEBUG, "WPA: Use EAPOL-Key timeout of %u ms (retry " +@@ -2882,6 +2886,11 @@ SM_STATE(WPA_PTK, PTKINITNEGOTIATING) + sm->TimeoutEvt = FALSE; + + sm->TimeoutCtr++; ++ if (sm->wpa_auth->conf.wpa_disable_eapol_key_retries && ++ sm->TimeoutCtr > 1) { ++ /* Do not allow retransmission of EAPOL-Key msg 3/4 */ ++ return; ++ } + if (sm->TimeoutCtr > sm->wpa_auth->conf.wpa_pairwise_update_count) { + /* No point in sending the EAPOL-Key - we will disconnect + * immediately following this. */ +@@ -3220,7 +3229,9 @@ SM_STEP(WPA_PTK) + sm->EAPOLKeyPairwise && sm->MICVerified) + SM_ENTER(WPA_PTK, PTKINITDONE); + else if (sm->TimeoutCtr > +- sm->wpa_auth->conf.wpa_pairwise_update_count) { ++ sm->wpa_auth->conf.wpa_pairwise_update_count || ++ (sm->wpa_auth->conf.wpa_disable_eapol_key_retries && ++ sm->TimeoutCtr > 1)) { + wpa_auth->dot11RSNA4WayHandshakeFailures++; + wpa_auth_vlogger( + sm->wpa_auth, sm->addr, LOGGER_DEBUG, +@@ -3260,6 +3271,11 @@ SM_STATE(WPA_PTK_GROUP, REKEYNEGOTIATING + SM_ENTRY_MA(WPA_PTK_GROUP, REKEYNEGOTIATING, wpa_ptk_group); + + sm->GTimeoutCtr++; ++ if (sm->wpa_auth->conf.wpa_disable_eapol_key_retries && ++ sm->GTimeoutCtr > 1) { ++ /* Do not allow retransmission of EAPOL-Key group msg 1/2 */ ++ return; ++ } + if (sm->GTimeoutCtr > sm->wpa_auth->conf.wpa_group_update_count) { + /* No point in sending the EAPOL-Key - we will disconnect + * immediately following this. */ +@@ -3363,7 +3379,9 @@ SM_STEP(WPA_PTK_GROUP) + !sm->EAPOLKeyPairwise && sm->MICVerified) + SM_ENTER(WPA_PTK_GROUP, REKEYESTABLISHED); + else if (sm->GTimeoutCtr > +- sm->wpa_auth->conf.wpa_group_update_count) ++ sm->wpa_auth->conf.wpa_group_update_count || ++ (sm->wpa_auth->conf.wpa_disable_eapol_key_retries && ++ sm->GTimeoutCtr > 1)) + SM_ENTER(WPA_PTK_GROUP, KEYERROR); + else if (sm->TimeoutEvt) + SM_ENTER(WPA_PTK_GROUP, REKEYNEGOTIATING); +--- a/src/ap/wpa_auth.h ++++ b/src/ap/wpa_auth.h +@@ -165,6 +165,7 @@ struct wpa_auth_config { + int wpa_ptk_rekey; + u32 wpa_group_update_count; + u32 wpa_pairwise_update_count; ++ int wpa_disable_eapol_key_retries; + int rsn_pairwise; + int rsn_preauth; + int eapol_version; +--- a/src/ap/wpa_auth_glue.c ++++ b/src/ap/wpa_auth_glue.c +@@ -45,6 +45,8 @@ static void hostapd_wpa_auth_conf(struct + wconf->wpa_gmk_rekey = conf->wpa_gmk_rekey; + wconf->wpa_ptk_rekey = conf->wpa_ptk_rekey; + wconf->wpa_group_update_count = conf->wpa_group_update_count; ++ wconf->wpa_disable_eapol_key_retries = ++ conf->wpa_disable_eapol_key_retries; + wconf->wpa_pairwise_update_count = conf->wpa_pairwise_update_count; + wconf->rsn_pairwise = conf->rsn_pairwise; + wconf->rsn_preauth = conf->rsn_preauth; diff --git a/package/network/services/hostapd/patches/011-Additional-consistentcy-checks-for-PTK-component-len.patch b/package/network/services/hostapd/patches/011-Additional-consistentcy-checks-for-PTK-component-len.patch new file mode 100644 index 0000000000..5cc2f7b17d --- /dev/null +++ b/package/network/services/hostapd/patches/011-Additional-consistentcy-checks-for-PTK-component-len.patch @@ -0,0 +1,100 @@ +From a6ea665300919d6a3af22b1f4237203647fda93a Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 17 Oct 2017 00:01:11 +0300 +Subject: [PATCH] Additional consistentcy checks for PTK component lengths + +Verify that TK, KCK, and KEK lengths are set to consistent values within +struct wpa_ptk before using them in supplicant. This is an additional +layer of protection against unexpected states. + +Signed-off-by: Jouni Malinen +--- + src/common/wpa_common.c | 6 ++++++ + src/rsn_supp/wpa.c | 26 ++++++++++++++++++++------ + 2 files changed, 26 insertions(+), 6 deletions(-) + +--- a/src/common/wpa_common.c ++++ b/src/common/wpa_common.c +@@ -100,6 +100,12 @@ int wpa_eapol_key_mic(const u8 *key, siz + { + u8 hash[SHA512_MAC_LEN]; + ++ if (key_len == 0) { ++ wpa_printf(MSG_DEBUG, ++ "WPA: KCK not set - cannot calculate MIC"); ++ return -1; ++ } ++ + switch (ver) { + #ifndef CONFIG_FIPS + case WPA_KEY_INFO_TYPE_HMAC_MD5_RC4: +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -725,6 +725,11 @@ static int wpa_supplicant_install_ptk(st + + alg = wpa_cipher_to_alg(sm->pairwise_cipher); + keylen = wpa_cipher_key_len(sm->pairwise_cipher); ++ if (keylen <= 0 || (unsigned int) keylen != sm->ptk.tk_len) { ++ wpa_printf(MSG_DEBUG, "WPA: TK length mismatch: %d != %lu", ++ keylen, (long unsigned int) sm->ptk.tk_len); ++ return -1; ++ } + rsclen = wpa_cipher_rsc_len(sm->pairwise_cipher); + + if (sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN) { +@@ -745,6 +750,7 @@ static int wpa_supplicant_install_ptk(st + + /* TK is not needed anymore in supplicant */ + os_memset(sm->ptk.tk, 0, WPA_TK_MAX_LEN); ++ sm->ptk.tk_len = 0; + sm->ptk.installed = 1; + + if (sm->wpa_ptk_rekey) { +@@ -1717,9 +1723,10 @@ static int wpa_supplicant_verify_eapol_k + os_memcpy(mic, key + 1, mic_len); + if (sm->tptk_set) { + os_memset(key + 1, 0, mic_len); +- wpa_eapol_key_mic(sm->tptk.kck, sm->tptk.kck_len, sm->key_mgmt, +- ver, buf, len, (u8 *) (key + 1)); +- if (os_memcmp_const(mic, key + 1, mic_len) != 0) { ++ if (wpa_eapol_key_mic(sm->tptk.kck, sm->tptk.kck_len, ++ sm->key_mgmt, ++ ver, buf, len, (u8 *) (key + 1)) < 0 || ++ os_memcmp_const(mic, key + 1, mic_len) != 0) { + wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, + "WPA: Invalid EAPOL-Key MIC " + "when using TPTK - ignoring TPTK"); +@@ -1742,9 +1749,10 @@ static int wpa_supplicant_verify_eapol_k + + if (!ok && sm->ptk_set) { + os_memset(key + 1, 0, mic_len); +- wpa_eapol_key_mic(sm->ptk.kck, sm->ptk.kck_len, sm->key_mgmt, +- ver, buf, len, (u8 *) (key + 1)); +- if (os_memcmp_const(mic, key + 1, mic_len) != 0) { ++ if (wpa_eapol_key_mic(sm->ptk.kck, sm->ptk.kck_len, ++ sm->key_mgmt, ++ ver, buf, len, (u8 *) (key + 1)) < 0 || ++ os_memcmp_const(mic, key + 1, mic_len) != 0) { + wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, + "WPA: Invalid EAPOL-Key MIC - " + "dropping packet"); +@@ -4167,6 +4175,11 @@ int fils_process_assoc_resp(struct wpa_s + + alg = wpa_cipher_to_alg(sm->pairwise_cipher); + keylen = wpa_cipher_key_len(sm->pairwise_cipher); ++ if (keylen <= 0 || (unsigned int) keylen != sm->ptk.tk_len) { ++ wpa_printf(MSG_DEBUG, "FILS: TK length mismatch: %u != %lu", ++ keylen, (long unsigned int) sm->ptk.tk_len); ++ goto fail; ++ } + rsclen = wpa_cipher_rsc_len(sm->pairwise_cipher); + wpa_hexdump_key(MSG_DEBUG, "FILS: Set TK to driver", + sm->ptk.tk, keylen); +@@ -4183,6 +4196,7 @@ int fils_process_assoc_resp(struct wpa_s + * takes care of association frame encryption/decryption. */ + /* TK is not needed anymore in supplicant */ + os_memset(sm->ptk.tk, 0, WPA_TK_MAX_LEN); ++ sm->ptk.tk_len = 0; + sm->ptk.installed = 1; + + /* FILS HLP Container */ diff --git a/package/network/services/hostapd/patches/012-Clear-BSSID-information-in-supplicant-state-machine-.patch b/package/network/services/hostapd/patches/012-Clear-BSSID-information-in-supplicant-state-machine-.patch new file mode 100644 index 0000000000..808d34586b --- /dev/null +++ b/package/network/services/hostapd/patches/012-Clear-BSSID-information-in-supplicant-state-machine-.patch @@ -0,0 +1,25 @@ +From c0fe5f125a9d4a6564e1f4956ccc3809bf2fd69d Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Tue, 17 Oct 2017 01:15:24 +0300 +Subject: [PATCH] Clear BSSID information in supplicant state machine on + disconnection + +This fixes a corner case where RSN pre-authentication candidate from +scan results was ignored if the station was associated with that BSS +just before running the new scan for the connection. + +Signed-off-by: Jouni Malinen +--- + src/rsn_supp/wpa.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -2662,6 +2662,7 @@ void wpa_sm_notify_disassoc(struct wpa_s + wpa_sm_drop_sa(sm); + + sm->msg_3_of_4_ok = 0; ++ os_memset(sm->bssid, 0, ETH_ALEN); + } + + diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index 6db16c9414..c8ca3694c0 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3014,6 +3014,10 @@ static int hostapd_config_fill(struct ho +@@ -3016,6 +3016,10 @@ static int hostapd_config_fill(struct ho } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N @@ -13,7 +13,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -734,6 +734,8 @@ struct hostapd_config { +@@ -735,6 +735,8 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 908641f638..e977f00a25 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -129,7 +129,7 @@ static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx) --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -3762,6 +3762,7 @@ static const char * wpa_bool_txt(int val +@@ -3780,6 +3780,7 @@ static const char * wpa_bool_txt(int val return val ? "TRUE" : "FALSE"; } @@ -137,7 +137,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -3906,7 +3907,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -3924,7 +3925,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -148,7 +148,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -2339,6 +2339,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -2356,6 +2356,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -157,7 +157,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -2422,6 +2424,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2439,6 +2441,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index bdbae9b48e..8f7a6879ca 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -1664,6 +1664,31 @@ u32 wpa_akm_to_suite(int akm) +@@ -1675,6 +1675,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -1671,8 +1696,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -1682,8 +1707,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 0c85a27ca5..31e3e79995 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -298,7 +298,7 @@ } --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -173,6 +173,7 @@ static void hostapd_wpa_auth_psk_failure +@@ -175,6 +175,7 @@ static void hostapd_wpa_auth_psk_failure struct hostapd_data *hapd = ctx; wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR, MAC2STR(addr)); -- 2.25.1