P2P NFC: Report handover select from tag for static handover
authorJouni Malinen <jouni@qca.qualcomm.com>
Sat, 27 Apr 2013 15:38:41 +0000 (18:38 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:10:56 +0000 (21:10 +0200)
WPS_NFC_TAG_READ can be used to report static connection handover where
the connection handover select message was read from an NFC tag.

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

wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h
wpa_supplicant/wps_supplicant.c

index 4e9dcc3..fe50b00 100644 (file)
@@ -7265,6 +7265,16 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
 }
 
 
+int wpas_p2p_nfc_tag_process(struct wpa_supplicant *wpa_s,
+                            const struct wpabuf *data)
+{
+       if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
+               return -1;
+
+       return wpas_p2p_nfc_connection_handover(wpa_s, data, 1, 1);
+}
+
+
 int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init,
                                 const struct wpabuf *req,
                                 const struct wpabuf *sel)
index 0f09d17..46c91cd 100644 (file)
@@ -152,6 +152,8 @@ struct wpabuf * wpas_p2p_nfc_handover_req(struct wpa_supplicant *wpa_s,
                                          int ndef);
 struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s,
                                          int ndef, int tag);
+int wpas_p2p_nfc_tag_process(struct wpa_supplicant *wpa_s,
+                            const struct wpabuf *data);
 int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init,
                                 const struct wpabuf *req,
                                 const struct wpabuf *sel);
index b485db9..02e3338 100644 (file)
@@ -2281,6 +2281,14 @@ int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
                /* Assume this contains full NDEF record */
                tmp = ndef_parse_wifi(data);
                if (tmp == NULL) {
+#ifdef CONFIG_P2P
+                       tmp = ndef_parse_p2p(data);
+                       if (tmp) {
+                               ret = wpas_p2p_nfc_tag_process(wpa_s, tmp);
+                               wpabuf_free(tmp);
+                               return ret;
+                       }
+#endif /* CONFIG_P2P */
                        wpa_printf(MSG_DEBUG, "WPS: Could not parse NDEF");
                        return -1;
                }