diff options
| -rw-r--r-- | src/ap/ctrl_iface_ap.c | 7 | ||||
| -rw-r--r-- | src/common/ieee802_11_common.c | 57 | ||||
| -rw-r--r-- | src/common/ieee802_11_common.h | 1 | ||||
| -rw-r--r-- | src/drivers/driver.h | 12 | ||||
| -rw-r--r-- | src/drivers/driver_nl80211.c | 35 | ||||
| -rw-r--r-- | src/eap_common/eap_sim_common.c | 2 | ||||
| -rw-r--r-- | src/eap_peer/eap_aka.c | 12 | ||||
| -rw-r--r-- | src/eap_peer/eap_sim.c | 12 | ||||
| -rw-r--r-- | src/p2p/p2p.c | 16 | ||||
| -rw-r--r-- | src/p2p/p2p.h | 10 | ||||
| -rw-r--r-- | wpa_supplicant/config.c | 5 | ||||
| -rw-r--r-- | wpa_supplicant/config.h | 9 | ||||
| -rw-r--r-- | wpa_supplicant/config_file.c | 6 | ||||
| -rw-r--r-- | wpa_supplicant/config_ssid.h | 4 | ||||
| -rw-r--r-- | wpa_supplicant/config_winreg.c | 3 | ||||
| -rw-r--r-- | wpa_supplicant/eapol_test.c | 33 | ||||
| -rw-r--r-- | wpa_supplicant/events.c | 2 | ||||
| -rw-r--r-- | wpa_supplicant/hs20_supplicant.c | 8 | ||||
| -rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 9 | ||||
| -rw-r--r-- | wpa_supplicant/scan.c | 1 | ||||
| -rw-r--r-- | wpa_supplicant/sme.c | 1 | ||||
| -rw-r--r-- | wpa_supplicant/wpa_supplicant.conf | 6 |
22 files changed, 207 insertions, 44 deletions
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index ccbbab5b..39edbd70 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -230,11 +230,12 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, if (mgmt == NULL) return -1; + mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, stype); wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "P2P: Disconnect STA " MACSTR - " with minor reason code %u (stype=%u)", - MAC2STR(addr), minor_reason_code, stype); + " with minor reason code %u (stype=%u (%s))", + MAC2STR(addr), minor_reason_code, stype, + fc2str(mgmt->frame_control)); - mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, stype); os_memcpy(mgmt->da, addr, ETH_ALEN); os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN); os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN); diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index faa6a39b..173a400d 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -546,3 +546,60 @@ int supp_rates_11b_only(struct ieee802_11_elems *elems) return num_11b > 0 && num_others == 0; } + + +const char * fc2str(u16 fc) +{ + u16 stype = WLAN_FC_GET_STYPE(fc); +#define C2S(x) case x: return #x; + + switch (WLAN_FC_GET_TYPE(fc)) { + case WLAN_FC_TYPE_MGMT: + switch (stype) { + C2S(WLAN_FC_STYPE_ASSOC_REQ) + C2S(WLAN_FC_STYPE_ASSOC_RESP) + C2S(WLAN_FC_STYPE_REASSOC_REQ) + C2S(WLAN_FC_STYPE_REASSOC_RESP) + C2S(WLAN_FC_STYPE_PROBE_REQ) + C2S(WLAN_FC_STYPE_PROBE_RESP) + C2S(WLAN_FC_STYPE_BEACON) + C2S(WLAN_FC_STYPE_ATIM) + C2S(WLAN_FC_STYPE_DISASSOC) + C2S(WLAN_FC_STYPE_AUTH) + C2S(WLAN_FC_STYPE_DEAUTH) + C2S(WLAN_FC_STYPE_ACTION) + } + break; + case WLAN_FC_TYPE_CTRL: + switch (stype) { + C2S(WLAN_FC_STYPE_PSPOLL) + C2S(WLAN_FC_STYPE_RTS) + C2S(WLAN_FC_STYPE_CTS) + C2S(WLAN_FC_STYPE_ACK) + C2S(WLAN_FC_STYPE_CFEND) + C2S(WLAN_FC_STYPE_CFENDACK) + } + break; + case WLAN_FC_TYPE_DATA: + switch (stype) { + C2S(WLAN_FC_STYPE_DATA) + C2S(WLAN_FC_STYPE_DATA_CFACK) + C2S(WLAN_FC_STYPE_DATA_CFPOLL) + C2S(WLAN_FC_STYPE_DATA_CFACKPOLL) + C2S(WLAN_FC_STYPE_NULLFUNC) + C2S(WLAN_FC_STYPE_CFACK) + C2S(WLAN_FC_STYPE_CFPOLL) + C2S(WLAN_FC_STYPE_CFACKPOLL) + C2S(WLAN_FC_STYPE_QOS_DATA) + C2S(WLAN_FC_STYPE_QOS_DATA_CFACK) + C2S(WLAN_FC_STYPE_QOS_DATA_CFPOLL) + C2S(WLAN_FC_STYPE_QOS_DATA_CFACKPOLL) + C2S(WLAN_FC_STYPE_QOS_NULL) + C2S(WLAN_FC_STYPE_QOS_CFPOLL) + C2S(WLAN_FC_STYPE_QOS_CFACKPOLL) + } + break; + } + return "WLAN_FC_TYPE_UNKNOWN"; +#undef C2S +} diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h index 9b8bbd1c..cf83057b 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -98,4 +98,5 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel); int supp_rates_11b_only(struct ieee802_11_elems *elems); +const char * fc2str(u16 fc); #endif /* IEEE802_11_COMMON_H */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 6e47b862..33f53af3 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -351,7 +351,7 @@ struct wpa_driver_scan_params { * Mbps from the support rates element(s) in the Probe Request frames * and not to transmit the frames at any of those rates. */ - u8 p2p_probe; + unsigned int p2p_probe:1; /** * only_new_results - Request driver to report only new results @@ -360,7 +360,15 @@ struct wpa_driver_scan_params { * been detected after this scan request has been started, i.e., to * flush old cached BSS entries. */ - int only_new_results; + unsigned int only_new_results:1; + + /** + * low_priority - Requests driver to use a lower scan priority + * + * This is used to request the driver to use a lower scan priority + * if it supports such a thing. + */ + unsigned int low_priority:1; /* * NOTE: Whenever adding new parameters here, please make sure diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index aa2cd04a..c154ec21 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -307,6 +307,7 @@ struct wpa_driver_nl80211_data { unsigned int test_use_roc_tx:1; unsigned int ignore_deauth_event:1; unsigned int dfs_vendor_cmd_avail:1; + unsigned int have_low_prio_scan:1; u64 remain_on_chan_cookie; u64 send_action_cookie; @@ -1735,8 +1736,10 @@ static void mlme_event_mgmt(struct i802_bss *bss, rx_freq = drv->last_mgmt_freq = event.rx_mgmt.freq; } wpa_printf(MSG_DEBUG, - "nl80211: RX frame freq=%d ssi_signal=%d stype=%u len=%u", - rx_freq, ssi_signal, stype, (unsigned int) len); + "nl80211: RX frame sa=" MACSTR + " freq=%d ssi_signal=%d stype=%u (%s) len=%u", + MAC2STR(mgmt->sa), rx_freq, ssi_signal, stype, fc2str(fc), + (unsigned int) len); event.rx_mgmt.frame = frame; event.rx_mgmt.frame_len = len; event.rx_mgmt.ssi_signal = ssi_signal; @@ -3411,6 +3414,7 @@ struct wiphy_info_data { unsigned int p2p_concurrent:1; unsigned int channel_switch_supported:1; unsigned int set_qos_map_supported:1; + unsigned int have_low_prio_scan:1; }; @@ -3689,6 +3693,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info, if (flags & NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE) capa->flags |= WPA_DRIVER_FLAGS_HT_2040_COEX; + + if (flags & NL80211_FEATURE_LOW_PRIORITY_SCAN) + info->have_low_prio_scan = 1; } @@ -3981,6 +3988,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv) drv->data_tx_status = info.data_tx_status; if (info.set_qos_map_supported) drv->capa.flags |= WPA_DRIVER_FLAGS_QOS_MAPPING; + drv->have_low_prio_scan = info.have_low_prio_scan; /* * If poll command and tx status are supported, mac80211 is new enough @@ -4384,8 +4392,8 @@ static int nl80211_register_frame(struct i802_bss *bss, buf[0] = '\0'; wpa_snprintf_hex(buf, sizeof(buf), match, match_len); - wpa_printf(MSG_DEBUG, "nl80211: Register frame type=0x%x nl_handle=%p match=%s", - type, nl_handle, buf); + wpa_printf(MSG_DEBUG, "nl80211: Register frame type=0x%x (%s) nl_handle=%p match=%s", + type, fc2str(type), nl_handle, buf); nl80211_cmd(drv, msg, 0, NL80211_CMD_REGISTER_ACTION); @@ -4949,6 +4957,7 @@ nl80211_scan_common(struct wpa_driver_nl80211_data *drv, u8 cmd, { struct nl_msg *msg; size_t i; + u32 scan_flags = 0; msg = nlmsg_alloc(); if (!msg) @@ -5007,10 +5016,18 @@ nl80211_scan_common(struct wpa_driver_nl80211_data *drv, u8 cmd, if (params->only_new_results) { wpa_printf(MSG_DEBUG, "nl80211: Add NL80211_SCAN_FLAG_FLUSH"); - NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, - NL80211_SCAN_FLAG_FLUSH); + scan_flags |= NL80211_SCAN_FLAG_FLUSH; } + if (params->low_priority && drv->have_low_prio_scan) { + wpa_printf(MSG_DEBUG, + "nl80211: Add NL80211_SCAN_FLAG_LOW_PRIORITY"); + scan_flags |= NL80211_SCAN_FLAG_LOW_PRIORITY; + } + + if (scan_flags) + NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, scan_flags); + return msg; fail: @@ -7070,8 +7087,10 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data, mgmt = (struct ieee80211_mgmt *) data; fc = le_to_host16(mgmt->frame_control); - wpa_printf(MSG_DEBUG, "nl80211: send_mlme - noack=%d freq=%u no_cck=%d offchanok=%d wait_time=%u fc=0x%x nlmode=%d", - noack, freq, no_cck, offchanok, wait_time, fc, drv->nlmode); + wpa_printf(MSG_DEBUG, "nl80211: send_mlme - da= " MACSTR + " noack=%d freq=%u no_cck=%d offchanok=%d wait_time=%u fc=0x%x (%s) nlmode=%d", + MAC2STR(mgmt->da), noack, freq, no_cck, offchanok, wait_time, + fc, fc2str(fc), drv->nlmode); if ((is_sta_interface(drv->nlmode) || drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) && diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c index e1773bf1..ae021858 100644 --- a/src/eap_common/eap_sim_common.c +++ b/src/eap_common/eap_sim_common.c @@ -893,7 +893,7 @@ int eap_sim_parse_attr(const u8 *start, const u8 *end, if (attr->kdf_count == EAP_AKA_PRIME_KDF_MAX) { wpa_printf(MSG_DEBUG, "EAP-AKA': Too many " "AT_KDF attributes - ignore this"); - continue; + break; } attr->kdf[attr->kdf_count] = WPA_GET_BE16(apos); attr->kdf_count++; diff --git a/src/eap_peer/eap_aka.c b/src/eap_peer/eap_aka.c index fee1b7b7..3f31866b 100644 --- a/src/eap_peer/eap_aka.c +++ b/src/eap_peer/eap_aka.c @@ -42,7 +42,7 @@ struct eap_aka_data { u8 *last_eap_identity; size_t last_eap_identity_len; enum { - CONTINUE, RESULT_SUCCESS, RESULT_FAILURE, SUCCESS, FAILURE + CONTINUE, RESULT_SUCCESS, SUCCESS, FAILURE } state; struct wpabuf *id_msgs; @@ -64,8 +64,6 @@ static const char * eap_aka_state_txt(int state) return "CONTINUE"; case RESULT_SUCCESS: return "RESULT_SUCCESS"; - case RESULT_FAILURE: - return "RESULT_FAILURE"; case SUCCESS: return "SUCCESS"; case FAILURE: @@ -1025,7 +1023,7 @@ static struct wpabuf * eap_aka_process_challenge(struct eap_sm *sm, if (data->result_ind && attr->result_ind) data->use_result_ind = 1; - if (data->state != FAILURE && data->state != RESULT_FAILURE) { + if (data->state != FAILURE) { eap_aka_state(data, data->use_result_ind ? RESULT_SUCCESS : SUCCESS); } @@ -1241,7 +1239,7 @@ static struct wpabuf * eap_aka_process_reauthentication( if (data->result_ind && attr->result_ind) data->use_result_ind = 1; - if (data->state != FAILURE && data->state != RESULT_FAILURE) { + if (data->state != FAILURE) { eap_aka_state(data, data->use_result_ind ? RESULT_SUCCESS : SUCCESS); } @@ -1347,9 +1345,7 @@ done: */ ret->methodState = data->use_result_ind ? METHOD_DONE : METHOD_MAY_CONT; - } else if (data->state == RESULT_FAILURE) - ret->methodState = METHOD_CONT; - else if (data->state == RESULT_SUCCESS) + } else if (data->state == RESULT_SUCCESS) ret->methodState = METHOD_CONT; if (ret->methodState == METHOD_DONE) { diff --git a/src/eap_peer/eap_sim.c b/src/eap_peer/eap_sim.c index fc9df96e..63c89396 100644 --- a/src/eap_peer/eap_sim.c +++ b/src/eap_peer/eap_sim.c @@ -43,7 +43,7 @@ struct eap_sim_data { u8 *last_eap_identity; size_t last_eap_identity_len; enum { - CONTINUE, RESULT_SUCCESS, RESULT_FAILURE, SUCCESS, FAILURE + CONTINUE, RESULT_SUCCESS, SUCCESS, FAILURE } state; int result_ind, use_result_ind; }; @@ -57,8 +57,6 @@ static const char * eap_sim_state_txt(int state) return "CONTINUE"; case RESULT_SUCCESS: return "RESULT_SUCCESS"; - case RESULT_FAILURE: - return "RESULT_FAILURE"; case SUCCESS: return "SUCCESS"; case FAILURE: @@ -788,7 +786,7 @@ static struct wpabuf * eap_sim_process_challenge(struct eap_sm *sm, if (data->result_ind && attr->result_ind) data->use_result_ind = 1; - if (data->state != FAILURE && data->state != RESULT_FAILURE) { + if (data->state != FAILURE) { eap_sim_state(data, data->use_result_ind ? RESULT_SUCCESS : SUCCESS); } @@ -989,7 +987,7 @@ static struct wpabuf * eap_sim_process_reauthentication( if (data->result_ind && attr->result_ind) data->use_result_ind = 1; - if (data->state != FAILURE && data->state != RESULT_FAILURE) { + if (data->state != FAILURE) { eap_sim_state(data, data->use_result_ind ? RESULT_SUCCESS : SUCCESS); } @@ -1088,9 +1086,7 @@ done: DECISION_UNCOND_SUCC : DECISION_COND_SUCC; ret->methodState = data->use_result_ind ? METHOD_DONE : METHOD_MAY_CONT; - } else if (data->state == RESULT_FAILURE) - ret->methodState = METHOD_CONT; - else if (data->state == RESULT_SUCCESS) + } else if (data->state == RESULT_SUCCESS) ret->methodState = METHOD_CONT; if (ret->methodState == METHOD_DONE) { diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 104f77ba..d0191e74 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1561,7 +1561,7 @@ void p2p_build_ssid(struct p2p_data *p2p, u8 *ssid, size_t *ssid_len) int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params) { p2p_build_ssid(p2p, params->ssid, ¶ms->ssid_len); - p2p_random(params->passphrase, 8); + p2p_random(params->passphrase, p2p->cfg->passphrase_len); return 0; } @@ -1595,7 +1595,7 @@ void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer) p2p->op_channel); os_memcpy(res.ssid, p2p->ssid, p2p->ssid_len); res.ssid_len = p2p->ssid_len; - p2p_random(res.passphrase, 8); + p2p_random(res.passphrase, p2p->cfg->passphrase_len); } else { res.freq = peer->oper_freq; if (p2p->ssid_len) { @@ -2388,7 +2388,8 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg) { struct p2p_data *p2p; - if (cfg->max_peers < 1) + if (cfg->max_peers < 1 || + cfg->passphrase_len < 8 || cfg->passphrase_len > 63) return NULL; p2p = os_zalloc(sizeof(*p2p) + sizeof(*cfg)); @@ -4719,3 +4720,12 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, } #endif /* CONFIG_WPS_NFC */ + + +int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len) +{ + if (len < 8 || len > 63) + return -1; + p2p->cfg->passphrase_len = len; + return 0; +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 9cf100fa..5938aa71 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -395,6 +395,14 @@ struct p2p_config { unsigned int max_listen; /** + * passphrase_len - Passphrase length (8..63) + * + * This parameter controls the length of the random passphrase that is + * generated at the GO. + */ + unsigned int passphrase_len; + + /** * cb_ctx - Context to use with callback functions */ void *cb_ctx; @@ -1960,4 +1968,6 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, int go_intent, const u8 *own_interface_addr); +int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len); + #endif /* P2P_H */ diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 4cea2ef9..8fd8ea13 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1736,6 +1736,9 @@ static const struct parse_data ssid_fields[] = { #ifdef CONFIG_MACSEC { INT_RANGE(macsec_policy, 0, 1) }, #endif /* CONFIG_MACSEC */ +#ifdef CONFIG_HS20 + { INT(update_identifier) }, +#endif /* CONFIG_HS20 */ }; #undef OFFSET @@ -3836,6 +3839,8 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(persistent_reconnect, 0, 1), 0 }, { INT_RANGE(p2p_intra_bss, 0, 1), CFG_CHANGED_P2P_INTRA_BSS }, { INT(p2p_group_idle), 0 }, + { INT_RANGE(p2p_passphrase_len, 8, 63), + CFG_CHANGED_P2P_PASSPHRASE_LEN }, { FUNC(p2p_pref_chan), CFG_CHANGED_P2P_PREF_CHAN }, { FUNC(p2p_no_go_freq), CFG_CHANGED_P2P_PREF_CHAN }, { INT_RANGE(p2p_add_cli_chan, 0, 1), 0 }, diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 3c2fc4ab..52add9da 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -317,6 +317,7 @@ struct wpa_cred { #define CFG_CHANGED_P2P_PREF_CHAN BIT(13) #define CFG_CHANGED_EXT_PW_BACKEND BIT(14) #define CFG_CHANGED_NFC_PASSWORD_TOKEN BIT(15) +#define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16) /** * struct wpa_config - wpa_supplicant configuration data @@ -716,6 +717,14 @@ struct wpa_config { int p2p_group_idle; /** + * p2p_passphrase_len - Passphrase length (8..63) for P2P GO + * + * This parameter controls the length of the random passphrase that is + * generated at the GO. + */ + unsigned int p2p_passphrase_len; + + /** * bss_max_count - Maximum number of BSS entries to keep in memory */ unsigned int bss_max_count; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 58e71118..98855d88 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -739,6 +739,9 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #ifdef CONFIG_MACSEC INT(macsec_policy); #endif /* CONFIG_MACSEC */ +#ifdef CONFIG_HS20 + INT(update_identifier); +#endif /* CONFIG_HS20 */ #undef STR #undef INT @@ -1016,6 +1019,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) fprintf(f, "p2p_intra_bss=%u\n", config->p2p_intra_bss); if (config->p2p_group_idle) fprintf(f, "p2p_group_idle=%u\n", config->p2p_group_idle); + if (config->p2p_passphrase_len) + fprintf(f, "p2p_passphrase_len=%u\n", + config->p2p_passphrase_len); if (config->p2p_pref_chan) { unsigned int i; fprintf(f, "p2p_pref_chan="); diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 76b0632e..ab474ff8 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -647,6 +647,10 @@ struct wpa_ssid { */ int macsec_policy; #endif /* CONFIG_MACSEC */ + +#ifdef CONFIG_HS20 + int update_identifier; +#endif /* CONFIG_HS20 */ }; #endif /* CONFIG_SSID_H */ diff --git a/wpa_supplicant/config_winreg.c b/wpa_supplicant/config_winreg.c index 00a10045..199f04fb 100644 --- a/wpa_supplicant/config_winreg.c +++ b/wpa_supplicant/config_winreg.c @@ -930,6 +930,9 @@ static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id) MGMT_FRAME_PROTECTION_DEFAULT); #endif /* CONFIG_IEEE80211W */ STR(id_str); +#ifdef CONFIG_HS20 + INT(update_identifier); +#endif /* CONFIG_HS20 */ #undef STR #undef INT diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c index 88d4241b..06a696e3 100644 --- a/wpa_supplicant/eapol_test.c +++ b/wpa_supplicant/eapol_test.c @@ -73,6 +73,9 @@ struct eapol_test_data { struct extra_radius_attr *extra_attrs; FILE *server_cert_file; + + const char *pcsc_reader; + const char *pcsc_pin; }; static struct eapol_test_data eapol_test; @@ -954,7 +957,7 @@ static void wpa_init_conf(struct eapol_test_data *e, } -static int scard_test(void) +static int scard_test(struct eapol_test_data *e) { struct scard_data *scard; size_t len; @@ -985,10 +988,10 @@ static int scard_test(void) unsigned char aka_ik[IK_LEN]; unsigned char aka_ck[CK_LEN]; - scard = scard_init(NULL); + scard = scard_init(e->pcsc_reader); if (scard == NULL) return -1; - if (scard_set_pin(scard, "1234")) { + if (scard_set_pin(scard, e->pcsc_pin)) { wpa_printf(MSG_WARNING, "PIN validation failed"); scard_deinit(scard); return -1; @@ -1063,7 +1066,7 @@ failed: } -static int scard_get_triplets(int argc, char *argv[]) +static int scard_get_triplets(struct eapol_test_data *e, int argc, char *argv[]) { struct scard_data *scard; size_t len; @@ -1085,7 +1088,7 @@ static int scard_get_triplets(int argc, char *argv[]) wpa_debug_level = 99; } - scard = scard_init(NULL); + scard = scard_init(e->pcsc_reader); if (scard == NULL) { printf("Failed to open smartcard connection\n"); return -1; @@ -1143,7 +1146,8 @@ static void usage(void) "[-s<AS secret>]\\\n" " [-r<count>] [-t<timeout>] [-C<Connect-Info>] \\\n" " [-M<client MAC address>] [-o<server cert file] \\\n" - " [-N<attr spec>] \\\n" + " [-N<attr spec>] [-R<PC/SC reader>] " + "[-P<PC/SC PIN>] \\\n" " [-A<client IP>]\n" "eapol_test scard\n" "eapol_test sim <PIN> <num triplets> [debug]\n" @@ -1208,12 +1212,13 @@ int main(int argc, char *argv[]) os_memset(&eapol_test, 0, sizeof(eapol_test)); eapol_test.connect_info = "CONNECT 11Mbps 802.11b"; os_memcpy(eapol_test.own_addr, "\x02\x00\x00\x00\x00\x01", ETH_ALEN); + eapol_test.pcsc_pin = "1234"; wpa_debug_level = 0; wpa_debug_show_keys = 1; for (;;) { - c = getopt(argc, argv, "a:A:c:C:eM:nN:o:p:r:s:St:W"); + c = getopt(argc, argv, "a:A:c:C:eM:nN:o:p:P:r:R:s:St:W"); if (c < 0) break; switch (c) { @@ -1254,9 +1259,14 @@ int main(int argc, char *argv[]) case 'p': as_port = atoi(optarg); break; + case 'P': + eapol_test.pcsc_pin = optarg; + break; case 'r': eapol_test.eapol_test_num_reauths = atoi(optarg); break; + case 'R': + eapol_test.pcsc_reader = optarg; case 's': as_secret = optarg; break; @@ -1304,11 +1314,11 @@ int main(int argc, char *argv[]) } if (argc > optind && os_strcmp(argv[optind], "scard") == 0) { - return scard_test(); + return scard_test(&eapol_test); } if (argc > optind && os_strcmp(argv[optind], "sim") == 0) { - return scard_get_triplets(argc - optind - 1, + return scard_get_triplets(&eapol_test, argc - optind - 1, &argv[optind + 1]); } @@ -1344,6 +1354,11 @@ int main(int argc, char *argv[]) return -1; } + if (eapol_test.pcsc_reader) { + os_free(wpa_s.conf->pcsc_reader); + wpa_s.conf->pcsc_reader = os_strdup(eapol_test.pcsc_reader); + } + wpa_init_conf(&eapol_test, &wpa_s, as_addr, as_port, as_secret, cli_addr); wpa_s.ctrl_iface = wpa_supplicant_ctrl_iface_init(&wpa_s); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 147836b7..ad24d4e5 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -342,7 +342,7 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM " "(sim=%d aka=%d) - initialize PCSC", sim, aka); - wpa_s->scard = scard_init(NULL); + wpa_s->scard = scard_init(wpa_s->conf->pcsc_reader); if (wpa_s->scard == NULL) { wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM " "(pcsc-lite)"); diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index ab8b66bb..257aa6d1 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -109,7 +109,13 @@ int hs20_get_pps_mo_id(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { struct wpa_cred *cred; - if (ssid == NULL || ssid->parent_cred == NULL) + if (ssid == NULL) + return 0; + + if (ssid->update_identifier) + return ssid->update_identifier; + + if (ssid->parent_cred == NULL) return 0; for (cred = wpa_s->conf->cred; cred; cred = cred->next) { diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 6b85efec..afa8121b 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3949,6 +3949,12 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) p2p.max_listen = wpa_s->max_remain_on_chan; + if (wpa_s->conf->p2p_passphrase_len >= 8 && + wpa_s->conf->p2p_passphrase_len <= 63) + p2p.passphrase_len = wpa_s->conf->p2p_passphrase_len; + else + p2p.passphrase_len = 8; + global->p2p = p2p_init(&p2p); if (global->p2p == NULL) return -1; @@ -6334,6 +6340,9 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s) "update failed"); } } + + if (wpa_s->conf->changed_parameters & CFG_CHANGED_P2P_PASSPHRASE_LEN) + p2p_set_passphrase_len(p2p, wpa_s->conf->p2p_passphrase_len); } diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index aaef3c31..a2b996ff 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1857,6 +1857,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src) params->filter_rssi = src->filter_rssi; params->p2p_probe = src->p2p_probe; params->only_new_results = src->only_new_results; + params->low_priority = src->low_priority; return params; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 81a1eded..1b043984 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1167,6 +1167,7 @@ static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx) os_memset(¶ms, 0, sizeof(params)); wpa_setband_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, ¶ms); + params.low_priority = 1; wpa_printf(MSG_DEBUG, "SME OBSS: Request an OBSS scan"); if (wpa_supplicant_trigger_scan(wpa_s, ¶ms)) diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index 191f2063..2a0dc204 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -269,6 +269,12 @@ fast_reauth=1 # inactive stations. #p2p_go_max_inactivity=300 +# Passphrase length (8..63) for P2P GO +# +# This parameter controls the length of the random passphrase that is +# generated at the GO. Default: 8. +#p2p_passphrase_len=8 + # Extra delay between concurrent P2P search iterations # # This value adds extra delay in milliseconds between concurrent search |
