]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Advertise IP Address Allocation only if it is enabled on GO
authorJouni Malinen <j@w1.fi>
Sun, 20 Mar 2016 09:46:04 +0000 (11:46 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 20 Mar 2016 15:37:53 +0000 (17:37 +0200)
This group capability bit was previously added unconditionally which
could result in the P2P Client assuming the functionality is available
even though the GO would always reject the request (not reply to it with
an assigned IP address) during the 4-way handshake.

Fix this by advertising the capability only if the GO configuration
allow IP address assignment to be completed.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/p2p/p2p.h
src/p2p/p2p_group.c
wpa_supplicant/p2p_supplicant.c

index fc545b4171d13622c9c203609d6aff4217793159..0feafd31208528139c4a0a5e64ae503feb17cf12 100644 (file)
@@ -1715,6 +1715,12 @@ struct p2p_group_config {
         */
        int freq;
 
+       /**
+        * ip_addr_alloc - Whether IP address allocation within 4-way handshake
+        *      is supported
+        */
+       int ip_addr_alloc;
+
        /**
         * cb_ctx - Context to use with callback functions
         */
index 2cf2450778d10876695c69888f381c492c9f48a3..eac73ef0c5d812abbcfda6775a47a4a4a5edddb9 100644 (file)
@@ -155,7 +155,8 @@ static void p2p_group_add_common_ies(struct p2p_group *group,
                group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
        if (group->num_members >= group->cfg->max_clients)
                group_capab |= P2P_GROUP_CAPAB_GROUP_LIMIT;
-       group_capab |= P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION;
+       if (group->cfg->ip_addr_alloc)
+               group_capab |= P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION;
        p2p_buf_add_capability(ie, dev_capab, group_capab);
 }
 
index 5ff758f6874fa020d94541aef87b64495f502ae2..67ca67cb57ca085ecce5dbd7b00e85bfc2d1a9ea 100644 (file)
@@ -6328,6 +6328,8 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
        cfg->cb_ctx = wpa_s;
        cfg->ie_update = wpas_p2p_ie_update;
        cfg->idle_update = wpas_p2p_idle_update;
+       cfg->ip_addr_alloc = WPA_GET_BE32(wpa_s->p2pdev->conf->ip_addr_start)
+               != 0;
 
        group = p2p_group_init(wpa_s->global->p2p, cfg);
        if (group == NULL)