aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-09-08 15:08:26 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-27 19:44:30 (GMT)
commitdd87677115ec62337e0a22b67ff55c52240c256d (patch)
tree312085289aa1fb0e7e253e3c84a079c18ee7c837 /wpa_supplicant
parentabe44e3ca20245ed991f105399b0e868b2e3b691 (diff)
downloadhostap-dd87677115ec62337e0a22b67ff55c52240c256d.zip
hostap-dd87677115ec62337e0a22b67ff55c52240c256d.tar.gz
hostap-dd87677115ec62337e0a22b67ff55c52240c256d.tar.bz2
P2P NFC: Enable own NFC Tag on GO Registrar
When "P2P_SET nfc_tag 1" is used to enable the own NFC Tag for P2P, also enable it for any running GO interface. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/p2p_supplicant.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 312efc9..b1e25ad 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -20,6 +20,7 @@
#include "ap/ap_config.h"
#include "ap/sta_info.h"
#include "ap/ap_drv_ops.h"
+#include "ap/wps_hostapd.h"
#include "ap/p2p_hostapd.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "rsn_supp/wpa.h"
@@ -7432,11 +7433,19 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
{
const u8 *if_addr;
int go_intent = wpa_s->conf->p2p_go_intent;
+ struct wpa_supplicant *iface;
if (wpa_s->global->p2p == NULL)
return -1;
if (!enabled) {
+ wpa_printf(MSG_DEBUG, "P2P: Disable use of own NFC Tag");
+ for (iface = wpa_s->global->ifaces; iface; iface = iface->next)
+ {
+ if (!iface->ap_iface)
+ continue;
+ hostapd_wps_nfc_token_disable(iface->ap_iface->bss[0]);
+ }
p2p_set_authorized_oob_dev_pw_id(wpa_s->global->p2p, 0,
0, NULL);
if (wpa_s->p2p_nfc_tag_enabled)
@@ -7457,6 +7466,8 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
return -1;
}
+ wpa_printf(MSG_DEBUG, "P2P: Enable use of own NFC Tag");
+
wpa_s->p2p_oob_dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id;
wpabuf_free(wpa_s->p2p_oob_dev_pw);
wpa_s->p2p_oob_dev_pw = wpabuf_dup(wpa_s->conf->wps_nfc_dev_pw);
@@ -7484,6 +7495,27 @@ int wpas_p2p_nfc_tag_enabled(struct wpa_supplicant *wpa_s, int enabled)
wpa_s->p2p_nfc_tag_enabled = enabled;
+ for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
+ struct hostapd_data *hapd;
+ if (iface->ap_iface == NULL)
+ continue;
+ hapd = iface->ap_iface->bss[0];
+ wpabuf_free(hapd->conf->wps_nfc_dh_pubkey);
+ hapd->conf->wps_nfc_dh_pubkey =
+ wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey);
+ wpabuf_free(hapd->conf->wps_nfc_dh_privkey);
+ hapd->conf->wps_nfc_dh_privkey =
+ wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey);
+ wpabuf_free(hapd->conf->wps_nfc_dev_pw);
+ hapd->conf->wps_nfc_dev_pw =
+ wpabuf_dup(wpa_s->conf->wps_nfc_dev_pw);
+ hapd->conf->wps_nfc_dev_pw_id = wpa_s->conf->wps_nfc_dev_pw_id;
+
+ if (hostapd_wps_nfc_token_enable(iface->ap_iface->bss[0]) < 0) {
+ wpa_dbg(iface, MSG_DEBUG,
+ "P2P: Failed to enable NFC Tag for GO");
+ }
+ }
p2p_set_authorized_oob_dev_pw_id(
wpa_s->global->p2p, wpa_s->conf->wps_nfc_dev_pw_id, go_intent,
if_addr);