Cumulative patch from commit d0df64373561a8804c35e1900e5857096f5b73d8
d0df643 wpa_supplicant: Call frequency conflict handling during auth
0cf24fd scan: Reset normal scan counter when a connection succeeds
dcdce14 radiotap: Fix compilation for systems without le16toh/le32toh
9176ec0 Android: Disable unused parameter warnings
2aa82e5 Interworking: Don't filter probe requests when interworking is disabled
13f6a07 Add SIM identifier to the network profile and cred block
Change-Id: I9135d23aea91ca2950b5eeefa9f81c38ab1ff4d1
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 6db82f8..74c9b27 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -24,6 +24,9 @@
# Set Android log name
L_CFLAGS += -DANDROID_LOG_NAME=\"hostapd\"
+# Disable unused parameter warnings
+L_CFLAGS += -Wno-unused-parameter
+
ifeq ($(BOARD_WLAN_DEVICE), bcmdhd)
L_CFLAGS += -DANDROID_P2P
endif
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index e06ce77..56df318 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -600,7 +600,8 @@
}
#ifdef CONFIG_INTERWORKING
- if (elems.interworking && elems.interworking_len >= 1) {
+ if (hapd->conf->interworking &&
+ elems.interworking && elems.interworking_len >= 1) {
u8 ant = elems.interworking[0] & 0x0f;
if (ant != INTERWORKING_ANT_WILDCARD &&
ant != hapd->conf->access_network_type) {
@@ -611,7 +612,7 @@
}
}
- if (elems.interworking &&
+ if (hapd->conf->interworking && elems.interworking &&
(elems.interworking_len == 7 || elems.interworking_len == 9)) {
const u8 *hessid;
if (elems.interworking_len == 7)
diff --git a/src/common/qca-vendor.h b/src/common/qca-vendor.h
index cea4701..0e292e6 100644
--- a/src/common/qca-vendor.h
+++ b/src/common/qca-vendor.h
@@ -19,6 +19,13 @@
#define OUI_QCA 0x001374
/**
+ * enum qca_radiotap_vendor_ids - QCA radiotap vendor namespace IDs
+ */
+enum qca_radiotap_vendor_ids {
+ QCA_RADIOTAP_VID_WLANTEST = 0,
+};
+
+/**
* enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers
*
* @QCA_NL80211_VENDOR_SUBCMD_UNSPEC: Reserved value 0
diff --git a/src/eap_peer/eap_config.h b/src/eap_peer/eap_config.h
index 98ec1f7..daa1d32 100644
--- a/src/eap_peer/eap_config.h
+++ b/src/eap_peer/eap_config.h
@@ -678,6 +678,14 @@
* SIM/USIM processing.
*/
char *external_sim_resp;
+
+ /**
+ * sim_num - User selected SIM identifier
+ *
+ * This variable is used for identifying which SIM is used if the system
+ * has more than one.
+ */
+ int sim_num;
};
diff --git a/src/utils/platform.h b/src/utils/platform.h
index 9ab734b..46cfe78 100644
--- a/src/utils/platform.h
+++ b/src/utils/platform.h
@@ -1,12 +1,12 @@
-#include <stddef.h>
-#include <errno.h>
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
-#include <endian.h>
+#ifndef PLATFORM_H
+#define PLATFORM_H
-#define le16_to_cpu le16toh
-#define le32_to_cpu le32toh
+#include "includes.h"
+#include "common.h"
+
+#define le16_to_cpu le_to_host16
+#define le32_to_cpu le_to_host32
+
#define get_unaligned(p) \
({ \
struct packed_dummy_struct { \
@@ -17,3 +17,5 @@
})
#define get_unaligned_le16(p) le16_to_cpu(get_unaligned((uint16_t *)(p)))
#define get_unaligned_le32(p) le32_to_cpu(get_unaligned((uint32_t *)(p)))
+
+#endif /* PLATFORM_H */
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index c8fe1c2..f56267c 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -24,6 +24,9 @@
# Set Android log name
L_CFLAGS += -DANDROID_LOG_NAME=\"wpa_supplicant\"
+# Disable unused parameter warnings
+L_CFLAGS += -Wno-unused-parameter
+
# Disable roaming in wpa_supplicant
ifdef CONFIG_NO_ROAMING
L_CFLAGS += -DCONFIG_NO_ROAMING
diff --git a/wpa_supplicant/README-HS20 b/wpa_supplicant/README-HS20
index d0b0b50..58c2475 100644
--- a/wpa_supplicant/README-HS20
+++ b/wpa_supplicant/README-HS20
@@ -270,6 +270,8 @@
# 1 = try to use OCSP stapling, but not require response
# 2 = require valid OCSP stapling response
#
+# sim_num: Identifier for which SIM to use in multi-SIM devices
+#
# for example:
#
#cred={
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index b4ee1f5..698b459 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1666,6 +1666,7 @@
{ INTe(engine) },
{ INTe(engine2) },
{ INT(eapol_flags) },
+ { INTe(sim_num) },
#endif /* IEEE8021X_EAPOL */
{ FUNC_KEY(wep_key0) },
{ FUNC_KEY(wep_key1) },
@@ -2154,6 +2155,7 @@
ssid->eapol_flags = DEFAULT_EAPOL_FLAGS;
ssid->eap_workaround = DEFAULT_EAP_WORKAROUND;
ssid->eap.fragment_size = DEFAULT_FRAGMENT_SIZE;
+ ssid->eap.sim_num = DEFAULT_USER_SELECTED_SIM;
#endif /* IEEE8021X_EAPOL */
#ifdef CONFIG_HT_OVERRIDES
ssid->disable_ht = DEFAULT_DISABLE_HT;
@@ -2572,6 +2574,11 @@
return 0;
}
+ if (os_strcmp(var, "sim_num") == 0) {
+ cred->sim_num = atoi(value);
+ return 0;
+ }
+
val = wpa_config_parse_string(value, &len);
if (val == NULL) {
wpa_printf(MSG_ERROR, "Line %d: invalid field '%s' string "
@@ -3100,6 +3107,7 @@
if (cred == NULL)
return NULL;
cred->id = id;
+ cred->sim_num = DEFAULT_USER_SELECTED_SIM;
if (last)
last->next = cred;
else
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index a398049..26b1233 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -288,6 +288,14 @@
* 2 = require valid OCSP stapling response
*/
int ocsp;
+
+ /**
+ * sim_num - User selected SIM identifier
+ *
+ * This variable is used for identifying which SIM is used if the system
+ * has more than one.
+ */
+ int sim_num;
};
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 8f0561a..8d59f49 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -219,6 +219,7 @@
if (cred == NULL)
return NULL;
cred->id = id;
+ cred->sim_num = DEFAULT_USER_SELECTED_SIM;
while (wpa_config_get_line(buf, sizeof(buf), f, line, &pos)) {
if (os_strcmp(pos, "}") == 0) {
@@ -712,6 +713,7 @@
STR(pac_file);
INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
INTe(ocsp);
+ INT_DEFe(sim_num, DEFAULT_USER_SELECTED_SIM);
#endif /* IEEE8021X_EAPOL */
INT(mode);
INT(frequency);
@@ -858,6 +860,9 @@
cred->required_roaming_consortium[i]);
fprintf(f, "\n");
}
+
+ if (cred->sim_num != DEFAULT_USER_SELECTED_SIM)
+ fprintf(f, "\tsim_num=%d\n", cred->sim_num);
}
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index a458990..18fb65b 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -34,6 +34,7 @@
#define DEFAULT_DISABLE_MAX_AMSDU -1 /* no change */
#define DEFAULT_AMPDU_FACTOR -1 /* no change */
#define DEFAULT_AMPDU_DENSITY -1 /* no change */
+#define DEFAULT_USER_SELECTED_SIM 1
struct psk_list_entry {
struct dl_list list;
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 3450ffe..f46c4cf 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -925,6 +925,7 @@
goto fail;
os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
ssid->ssid_len = bss->ssid_len;
+ ssid->eap.sim_num = cred->sim_num;
if (interworking_set_hs20_params(wpa_s, ssid) < 0)
goto fail;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 2538ba0..9b6667a 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -416,6 +416,32 @@
if (old_ssid != wpa_s->current_ssid)
wpas_notify_network_changed(wpa_s);
+#ifdef CONFIG_P2P
+ /*
+ * If multi-channel concurrency is not supported, check for any
+ * frequency conflict. In case of any frequency conflict, remove the
+ * least prioritized connection.
+ */
+ if (wpa_s->num_multichan_concurrent < 2) {
+ int freq, num;
+ num = get_shared_radio_freqs(wpa_s, &freq, 1);
+ if (num > 0 && freq > 0 && freq != params.freq) {
+ wpa_printf(MSG_DEBUG,
+ "Conflicting frequency found (%d != %d)",
+ freq, params.freq);
+ if (wpas_p2p_handle_frequency_conflicts(wpa_s,
+ params.freq,
+ ssid) < 0) {
+ wpas_connection_failed(wpa_s, bss->bssid);
+ wpa_supplicant_mark_disassoc(wpa_s);
+ wpabuf_free(resp);
+ wpas_connect_work_done(wpa_s);
+ return;
+ }
+ }
+ }
+#endif /* CONFIG_P2P */
+
wpa_s->sme.auth_alg = params.auth_alg;
if (wpa_drv_authenticate(wpa_s, ¶ms) < 0) {
wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5d9cbf7..af7b847 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -673,8 +673,11 @@
wpa_s->normal_scans = 0;
}
- if (state == WPA_COMPLETED)
+ if (state == WPA_COMPLETED) {
wpas_connect_work_done(wpa_s);
+ /* Reinitialize normal_scan counter */
+ wpa_s->normal_scans = 0;
+ }
if (state != WPA_SCANNING)
wpa_supplicant_notify_scanning(wpa_s, 0);
@@ -1819,9 +1822,11 @@
* least prioritized connection.
*/
if (wpa_s->num_multichan_concurrent < 2) {
- int freq = wpa_drv_shared_freq(wpa_s);
- if (freq > 0 && freq != params.freq) {
- wpa_printf(MSG_DEBUG, "Shared interface with conflicting frequency found (%d != %d)",
+ int freq, num;
+ num = get_shared_radio_freqs(wpa_s, &freq, 1);
+ if (num > 0 && freq > 0 && freq != params.freq) {
+ wpa_printf(MSG_DEBUG,
+ "Assoc conflicting freq found (%d != %d)",
freq, params.freq);
if (wpas_p2p_handle_frequency_conflicts(wpa_s,
params.freq,
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 86a4621..81fbdfb 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -483,6 +483,8 @@
# 1 = try to use OCSP stapling, but not require response
# 2 = require valid OCSP stapling response
#
+# sim_num: Identifier for which SIM to use in multi-SIM devices
+#
# for example:
#
#cred={