aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/ctrl_iface.c20
-rw-r--r--wpa_supplicant/events.c8
-rw-r--r--wpa_supplicant/p2p_supplicant.c40
-rw-r--r--wpa_supplicant/scan.c12
-rw-r--r--wpa_supplicant/wpa_supplicant.c5
-rw-r--r--wpa_supplicant/wps_supplicant.c2
6 files changed, 65 insertions, 22 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0d8821b..bcf27be 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3547,11 +3547,18 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
char *pos;
int id;
struct wpa_ssid *ssid;
- u8 peer[ETH_ALEN];
+ u8 *_peer = NULL, peer[ETH_ALEN];
int freq = 0;
int ht40;
id = atoi(cmd);
+ pos = os_strstr(cmd, " peer=");
+ if (pos) {
+ pos += 6;
+ if (hwaddr_aton(pos, peer))
+ return -1;
+ _peer = peer;
+ }
ssid = wpa_config_get_network(wpa_s->conf, id);
if (ssid == NULL || ssid->disabled != 2) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find SSID id=%d "
@@ -3568,17 +3575,9 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
return -1;
}
- pos = os_strstr(cmd, " peer=");
- if (pos) {
- pos += 6;
- if (hwaddr_aton(pos, peer))
- return -1;
- }
-
ht40 = os_strstr(cmd, " ht40") != NULL;
- return wpas_p2p_invite(wpa_s, pos ? peer : NULL, ssid, NULL, freq,
- ht40);
+ return wpas_p2p_invite(wpa_s, _peer, ssid, NULL, freq, ht40);
}
@@ -4402,6 +4401,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
level = MSG_EXCESSIVE;
wpa_hexdump_ascii(level, "RX ctrl_iface",
(const u8 *) buf, os_strlen(buf));
+ wpa_dbg(wpa_s, level, "Control interface command '%s'", buf);
}
reply = os_malloc(reply_size);
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index fdcbcc2..6e9d7ba 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -854,7 +854,12 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
* we don't wait timeout seconds before transitioning
* to INACTIVE state.
*/
+ wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request "
+ "since there are no enabled networks");
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
+#ifdef CONFIG_P2P
+ wpa_s->sta_scan_pending = 0;
+#endif /* CONFIG_P2P */
return;
}
wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
@@ -1059,7 +1064,8 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_P2P
if (wpa_s->global->p2p_cb_on_scan_complete &&
!wpa_s->global->p2p_disabled &&
- wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) {
+ wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending &&
+ !wpa_s->scan_res_handler) {
wpa_s->global->p2p_cb_on_scan_complete = 0;
if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) {
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation "
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 903c94f..cf8f935 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -267,13 +267,12 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
if (ssid == NULL) {
/*
* The current SSID was not known, but there may still be a
- * pending P2P group interface waiting for provisioning.
+ * pending P2P group interface waiting for provisioning or a
+ * P2P group that is trying to reconnect.
*/
ssid = wpa_s->conf->ssid;
while (ssid) {
- if (ssid->p2p_group &&
- (ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION ||
- (ssid->key_mgmt & WPA_KEY_MGMT_WPS)))
+ if (ssid->p2p_group)
break;
ssid = ssid->next;
}
@@ -873,12 +872,18 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
{
struct wpa_ssid *ssid;
- if (wpas_copy_go_neg_results(wpa_s, params) < 0)
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Starting GO");
+ if (wpas_copy_go_neg_results(wpa_s, params) < 0) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Could not copy GO Negotiation "
+ "results");
return;
+ }
ssid = wpa_config_add_network(wpa_s->conf);
- if (ssid == NULL)
+ if (ssid == NULL) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Could not add network for GO");
return;
+ }
wpa_s->show_group_started = 0;
@@ -900,6 +905,13 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
ssid->proto = WPA_PROTO_RSN;
ssid->pairwise_cipher = WPA_CIPHER_CCMP;
ssid->passphrase = os_strdup(params->passphrase);
+ if (ssid->passphrase == NULL) {
+ wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to copy passphrase for "
+ "GO");
+ wpa_config_remove_network(wpa_s->conf, ssid->id);
+ return;
+ }
+ wpa_config_update_psk(ssid);
ssid->ap_max_inactivity = wpa_s->parent->conf->p2p_go_max_inactivity;
wpa_s->ap_configured_cb = p2p_go_configured;
@@ -908,6 +920,8 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
wpa_s->connect_without_scan = ssid;
wpa_s->reassociate = 1;
wpa_s->disconnected = 0;
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Request scan (that will be skipped) to "
+ "start GO)");
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
@@ -2517,7 +2531,6 @@ struct p2p_oper_class_map {
static struct p2p_oper_class_map op_class[] = {
{ HOSTAPD_MODE_IEEE80211G, 81, 1, 13, 1, BW20 },
- { HOSTAPD_MODE_IEEE80211G, 82, 14, 14, 1, BW20 },
#if 0 /* Do not enable HT40 on 2 GHz for now */
{ HOSTAPD_MODE_IEEE80211G, 83, 1, 9, 1, BW40PLUS },
{ HOSTAPD_MODE_IEEE80211G, 84, 5, 13, 1, BW40MINUS },
@@ -3820,18 +3833,27 @@ wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
{
struct wpa_supplicant *group_wpa_s;
- if (!wpas_p2p_create_iface(wpa_s))
+ if (!wpas_p2p_create_iface(wpa_s)) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use same interface for group "
+ "operations");
return wpa_s;
+ }
if (wpas_p2p_add_group_interface(wpa_s, go ? WPA_IF_P2P_GO :
- WPA_IF_P2P_CLIENT) < 0)
+ WPA_IF_P2P_CLIENT) < 0) {
+ wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to add group interface");
return NULL;
+ }
group_wpa_s = wpas_p2p_init_group_interface(wpa_s, go);
if (group_wpa_s == NULL) {
+ wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to initialize group "
+ "interface");
wpas_p2p_remove_pending_group_interface(wpa_s);
return NULL;
}
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use separate group interface %s",
+ group_wpa_s->ifname);
return group_wpa_s;
}
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index bf55f5e..0f6433b 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -83,15 +83,21 @@ static int wpas_wps_in_use(struct wpa_supplicant *wpa_s,
int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s)
{
struct wpa_ssid *ssid = wpa_s->conf->ssid;
- int count = 0;
+ int count = 0, disabled = 0;
while (ssid) {
if (!wpas_network_disabled(wpa_s, ssid))
count++;
+ else
+ disabled++;
ssid = ssid->next;
}
if (wpa_s->conf->cred && wpa_s->conf->interworking &&
wpa_s->conf->auto_interworking)
count++;
+ if (count == 0 && disabled > 0) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks (%d disabled "
+ "networks)", disabled);
+ }
return count;
}
@@ -450,6 +456,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
}
if (wpa_s->disconnected && !wpa_s->scan_req) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "Disconnected - do not scan");
wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
return;
}
@@ -464,6 +471,9 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
!wpa_s->scan_req) {
wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
+#ifdef CONFIG_P2P
+ wpa_s->sta_scan_pending = 0;
+#endif /* CONFIG_P2P */
return;
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 49830d6..d8f3c44 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1255,7 +1255,10 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
"mode");
return;
}
- wpa_supplicant_create_ap(wpa_s, ssid);
+ if (wpa_supplicant_create_ap(wpa_s, ssid) < 0) {
+ wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ return;
+ }
wpa_s->current_bss = bss;
#else /* CONFIG_AP */
wpa_msg(wpa_s, MSG_ERROR, "AP mode support not included in "
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 130f3ab..915ca57 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1869,6 +1869,7 @@ static int wpas_wps_use_cred(struct wpa_supplicant *wpa_s,
}
+#ifdef CONFIG_WPS_ER
static int wpas_wps_add_nfc_password_token(struct wpa_supplicant *wpa_s,
struct wps_parse_attr *attr)
{
@@ -1876,6 +1877,7 @@ static int wpas_wps_add_nfc_password_token(struct wpa_supplicant *wpa_s,
wpa_s->wps->registrar, attr->oob_dev_password,
attr->oob_dev_password_len);
}
+#endif /* CONFIG_WPS_ER */
static int wpas_wps_nfc_tag_process(struct wpa_supplicant *wpa_s,