]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix PSK configuration for GO network
authorJouni Malinen <j@w1.fi>
Sun, 23 Sep 2012 21:56:57 +0000 (00:56 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 Sep 2012 21:56:57 +0000 (00:56 +0300)
Setting just ssid->passphrase is not enough to complete the network
block for the GO entry. Also the PSK needs to be derived so that the
network is considered enabled by wpas_network_disabled(). The previous
version worked as long as something else allowed the scan request to be
performed (this is needed even though the actual scan is skipped when
starting GO).

The first GO start was allowed because wpa_s->scan_req is initialized to
1 in wpa_supplicant_alloc(). However, other attempts may fail if
wpa_s->scan_req is cleared. This failure shows up as "No enabled
networkas - do not scan" in debug log followed by state change to
INACTIVE when trying to start GO.

Fix this by deriving PSK from the passphrase for GO mode.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/p2p_supplicant.c

index b581f326546f2aac27bccee12f2b09784ed3aa48..4463eb6c86421cc8f5832dae74ee60197a3d33be 100644 (file)
@@ -875,6 +875,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;