]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2PS: Provision Discovery fail event
authorKrishna Vamsi <vamsin@qti.qualcomm.com>
Wed, 10 Dec 2014 11:51:09 +0000 (17:21 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 2 Feb 2015 23:35:07 +0000 (01:35 +0200)
This extends P2P-PROV-DISC-FAILURE with adv_id and deferred_session_resp
in P2PS cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/p2p/p2p.c
src/p2p/p2p.h
src/p2p/p2p_pd.c
wpa_supplicant/p2p_supplicant.c

index 603585a78690e06b7da9a6b7470b704829311a6d..f59e919d243a5792c6fdcd9ed4d2817ea50d454a 100644 (file)
@@ -3832,6 +3832,9 @@ static void p2p_timeout_prov_disc_during_find(struct p2p_data *p2p)
 
 static void p2p_timeout_prov_disc_req(struct p2p_data *p2p)
 {
+       u32 adv_id = 0;
+       u8 *adv_mac = NULL;
+
        p2p->pending_action_state = P2P_NO_PENDING_ACTION;
 
        /*
@@ -3860,12 +3863,18 @@ static void p2p_timeout_prov_disc_req(struct p2p_data *p2p)
                                for_join = 1;
                }
 
+               if (p2p->p2ps_prov) {
+                       adv_id = p2p->p2ps_prov->adv_id;
+                       adv_mac = p2p->p2ps_prov->adv_mac;
+               }
+
                if (p2p->cfg->prov_disc_fail)
                        p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx,
                                                 p2p->pending_pd_devaddr,
                                                 for_join ?
                                                 P2P_PROV_DISC_TIMEOUT_JOIN :
-                                                P2P_PROV_DISC_TIMEOUT);
+                                                P2P_PROV_DISC_TIMEOUT,
+                                                adv_id, adv_mac, NULL);
                p2p_reset_pending_pd(p2p);
        }
 }
index f00e13d98b6622112bfea58fbaa9d152469c8169..3e1cbbf35c7c7fe7a058bf5387cb11d9345b1d37 100644 (file)
@@ -808,6 +808,9 @@ struct p2p_config {
         * @ctx: Callback context from cb_ctx
         * @peer: Source address of the response
         * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS
+        * @adv_id: If non-zero, then the adv_id of the PD Request
+        * @adv_mac: P2P Device Address of the advertizer
+        * @deferred_session_resp: Deferred session response sent by advertizer
         *
         * This callback is used to indicate either a failure or no response
         * to an earlier provision discovery request.
@@ -816,7 +819,9 @@ struct p2p_config {
         * is not used or failures do not need to be indicated.
         */
        void (*prov_disc_fail)(void *ctx, const u8 *peer,
-                              enum p2p_prov_disc_status status);
+                              enum p2p_prov_disc_status status,
+                              u32 adv_id, const u8 *adv_mac,
+                              const char *deferred_session_resp);
 
        /**
         * invitation_process - Optional callback for processing Invitations
index 02172ef9b12aea873bbb5790b7a4a132e646bc07..5c40c1c6112143976f9594381d21c700ab6a3df1 100644 (file)
@@ -841,7 +841,8 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
                        msg.wps_config_methods, req_config_methods);
                if (p2p->cfg->prov_disc_fail)
                        p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa,
-                                                P2P_PROV_DISC_REJECTED);
+                                                P2P_PROV_DISC_REJECTED,
+                                                0, NULL, NULL);
                p2p_parse_free(&msg);
                goto out;
        }
index cf1e29a09f53bea5ef745f2b79c5f9632e464f63..81b1d6d81c5b29eac6b9249a52a272006beddb66 100644 (file)
@@ -3706,7 +3706,9 @@ static void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
 
 
 static void wpas_prov_disc_fail(void *ctx, const u8 *peer,
-                               enum p2p_prov_disc_status status)
+                               enum p2p_prov_disc_status status,
+                               u32 adv_id, const u8 *adv_mac,
+                               const char *deferred_session_resp)
 {
        struct wpa_supplicant *wpa_s = ctx;
 
@@ -3726,9 +3728,21 @@ static void wpas_prov_disc_fail(void *ctx, const u8 *peer,
                return;
        }
 
-       wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
-                      " p2p_dev_addr=" MACSTR " status=%d",
-                      MAC2STR(peer), status);
+       if (adv_id && adv_mac && deferred_session_resp) {
+               wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
+                              " p2p_dev_addr=" MACSTR " status=%d adv_id=%x"
+                              " deferred_session_resp='%s'",
+                              MAC2STR(peer), status, adv_id,
+                              deferred_session_resp);
+       } else if (adv_id && adv_mac) {
+               wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
+                              " p2p_dev_addr=" MACSTR " status=%d adv_id=%x",
+                              MAC2STR(peer), status, adv_id);
+       } else {
+               wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
+                              " p2p_dev_addr=" MACSTR " status=%d",
+                              MAC2STR(peer), status);
+       }
 
        wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
                                            status, 0, 0);