#define P2P_EVENT_P2PS_PROVISION_START "P2PS-PROV-START "
#define P2P_EVENT_P2PS_PROVISION_DONE "P2PS-PROV-DONE "
+#define P2P_EVENT_BOOTSTRAP_REQUEST "P2P-BOOTSTRAP-REQUEST "
+#define P2P_EVENT_BOOTSTRAP_SUCCESS "P2P-BOOTSTRAP-SUCCESS "
+#define P2P_EVENT_BOOTSTRAP_FAILURE "P2P-BOOTSTRAP-FAILURE "
+
#define INTERWORKING_AP "INTERWORKING-AP "
#define INTERWORKING_EXCLUDED "INTERWORKING-BLACKLISTED "
#define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
*/
void (*register_bootstrap_comeback)(void *ctx, const u8 *addr,
u16 comeback_after);
+
+ /**
+ * bootstrap_req_rx - Indicate bootstrap request from a P2P peer
+ * @ctx: Callback context from cb_ctx
+ * @addr: P2P device address from which bootstrap request was received
+ * @bootstrap_method: Bootstrapping method request by the peer device
+ *
+ * This function can be used to notify that bootstrap request is
+ * received from a P2P peer.
+ */
+ void (*bootstrap_req_rx)(void *ctx, const u8 *addr,
+ u16 bootstrap_method);
+
+ /**
+ * bootstrap_completed - Indicate bootstrapping completed with P2P peer
+ * @ctx: Callback context from cb_ctx
+ * @addr: P2P device address with which bootstrapping is completed
+ * @status: P2P Status Code of bootstrapping handshake
+ * @freq: Frequency in which bootstrapping is done
+ *
+ * This function can be used to notify the status of bootstrapping
+ * handshake.
+ */
+ void (*bootstrap_completed)(void *ctx, const u8 *addr,
+ enum p2p_status_code status, int freq);
};
if (!dev->req_bootstrap_method) {
status = P2P_SC_COMEBACK;
+ if (p2p->cfg->bootstrap_req_rx)
+ p2p->cfg->bootstrap_req_rx(p2p->cfg->cb_ctx,
+ sa, bootstrap);
goto out;
}
} else {
dev->bootstrap_params->comeback_after =
p2p->cfg->comeback_after;
status = P2P_SC_COMEBACK;
+ if (p2p->cfg->bootstrap_req_rx)
+ p2p->cfg->bootstrap_req_rx(p2p->cfg->cb_ctx,
+ sa, bootstrap);
goto out;
}
}
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG)
dev->flags &= ~P2P_DEV_PD_BEFORE_GO_NEG;
+
+ if (p2p->cfg->bootstrap_completed)
+ p2p->cfg->bootstrap_completed(p2p->cfg->cb_ctx, sa, status,
+ rx_freq);
}
}
+static void wpas_bootstrap_req_rx(void *ctx, const u8 *addr,
+ u16 bootstrap_method)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_BOOTSTRAP_REQUEST MACSTR
+ " bootstrap_method=%u", MAC2STR(addr), bootstrap_method);
+}
+
+
+static void wpas_bootstrap_completed(void *ctx, const u8 *addr,
+ enum p2p_status_code status, int freq)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ if (status) {
+ wpa_msg_global(wpa_s, MSG_INFO,
+ P2P_EVENT_BOOTSTRAP_FAILURE MACSTR " status=%d",
+ MAC2STR(addr), status);
+ } else {
+ wpa_msg_global(wpa_s, MSG_INFO,
+ P2P_EVENT_BOOTSTRAP_SUCCESS MACSTR " status=%d",
+ MAC2STR(addr), status);
+ }
+}
+
+
int wpas_p2p_mac_setup(struct wpa_supplicant *wpa_s)
{
u8 addr[ETH_ALEN] = {0};
p2p.get_pref_freq_list = wpas_p2p_get_pref_freq_list;
p2p.p2p_6ghz_disable = wpa_s->conf->p2p_6ghz_disable;
p2p.register_bootstrap_comeback = wpas_p2p_register_bootstrap_comeback;
+ p2p.bootstrap_req_rx = wpas_bootstrap_req_rx;
+ p2p.bootstrap_completed = wpas_bootstrap_completed;
os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN);
os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN);