]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P NFC: Do not try to join peer if both devices are already GO
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 4 Apr 2013 12:32:09 +0000 (15:32 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:44:30 +0000 (21:44 +0200)
Send a P2P-NFC-BOTH-GO event to upper layers to determine what to
do in case both devices going through NFC connection handover are
already operating as a GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/common/wpa_ctrl.h
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/p2p_supplicant.c

index 57c38787d6d78c5140e56b580dbed60ceaab4d8a..5948ca7b151a2edbe78e33b3521eb98dd2a78004 100644 (file)
@@ -150,6 +150,7 @@ extern "C" {
 #define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
 #define P2P_EVENT_PERSISTENT_PSK_FAIL "P2P-PERSISTENT-PSK-FAIL id="
 #define P2P_EVENT_PRESENCE_RESPONSE "P2P-PRESENCE-RESPONSE "
+#define P2P_EVENT_NFC_BOTH_GO "P2P-NFC-BOTH-GO "
 
 /* parameters: <PMF enabled> <timeout in ms> <Session Information URL> */
 #define ESS_DISASSOC_IMMINENT "ESS-DISASSOC-IMMINENT "
index 708db4c0303747f2783adaee74ece797d7654b04..3e9bc19674159b488bc74133d4016173059df98f 100644 (file)
@@ -4516,7 +4516,9 @@ int p2p_process_nfc_connection_handover(struct p2p_data *p2p,
                dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE;
        }
 
-       if (peer_go)
+       if (peer_go && p2p->num_groups > 0)
+               params->next_step = BOTH_GO;
+       else if (peer_go)
                params->next_step = JOIN_GROUP;
        else if (p2p->num_groups > 0)
                params->next_step = AUTH_JOIN;
index fcf8cfc55a43cd74920cba80ef94820bfe5194f9..d5432c0a77a75cd047eb36b67ffa1571fb7ad60f 100644 (file)
@@ -1910,7 +1910,8 @@ struct p2p_nfc_params {
        size_t p2p_len;
 
        enum {
-               NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG
+               NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG,
+               BOTH_GO
        } next_step;
        struct p2p_peer_info *peer;
        u8 oob_dev_pw[WPS_OOB_PUBKEY_HASH_LEN + 2 +
index 4375d9bbc46ae45e16cef50c9776ba2636fb44e2..fa8c648648e448316fd85e291f7a0ab7c6c15f42 100644 (file)
@@ -7212,6 +7212,15 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
        if (res)
                return res;
 
+       if (params.next_step == NO_ACTION)
+               return 0;
+
+       if (params.next_step == BOTH_GO) {
+               wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_NFC_BOTH_GO "peer=" MACSTR,
+                       MAC2STR(params.peer->p2p_device_addr));
+               return 0;
+       }
+
        wpabuf_free(wpa_s->p2p_oob_dev_pw);
        wpa_s->p2p_oob_dev_pw = NULL;
 
@@ -7261,6 +7270,8 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
 
        switch (params.next_step) {
        case NO_ACTION:
+       case BOTH_GO:
+               /* already covered above */
                return 0;
        case JOIN_GROUP:
                return wpas_p2p_nfc_join_group(wpa_s, &params);