aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/wps-ap-nfc.py
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-02-11 16:43:46 (GMT)
committerJouni Malinen <j@w1.fi>2013-02-11 16:43:46 (GMT)
commite47588279af1af78ccdc88cf93df83003c01061b (patch)
treeee210e1fad1e622c379a519c7afa85dbf4d05546 /hostapd/wps-ap-nfc.py
parentec01d5f6b0bec5f02960b910b78f860a6d0189ad (diff)
downloadhostap-e47588279af1af78ccdc88cf93df83003c01061b.zip
hostap-e47588279af1af78ccdc88cf93df83003c01061b.tar.gz
hostap-e47588279af1af78ccdc88cf93df83003c01061b.tar.bz2
WPS: Report NFC connection handover completion differently
Instead of reporting only one connection handover message, report completion of NFC connection handover with carrier record from both the request and select messages. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'hostapd/wps-ap-nfc.py')
-rwxr-xr-xhostapd/wps-ap-nfc.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/hostapd/wps-ap-nfc.py b/hostapd/wps-ap-nfc.py
index 61fa677..32a0214 100755
--- a/hostapd/wps-ap-nfc.py
+++ b/hostapd/wps-ap-nfc.py
@@ -73,11 +73,13 @@ def wpas_get_handover_sel():
return wpas.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip().decode("hex")
-def wpas_put_handover_sel(message):
+def wpas_report_handover(req, sel):
wpas = wpas_connect()
if (wpas == None):
- return
- print wpas.request("NFC_RX_HANDOVER_SEL " + str(message).encode("hex"))
+ return None
+ return wpas.request("NFC_REPORT_HANDOVER RESP WPS " +
+ str(req).encode("hex") + " " +
+ str(sel).encode("hex"))
class HandoverServer(nfc.handover.HandoverServer):
@@ -94,12 +96,14 @@ class HandoverServer(nfc.handover.HandoverServer):
print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.wsc":
print "WPS carrier type match - add WPS carrier record"
+ self.received_carrier = carrier.record
data = wpas_get_handover_sel()
if data is None:
print "Could not get handover select carrier record from hostapd"
continue
print "Handover select carrier record from hostapd:"
print data.encode("hex")
+ self.sent_carrier = data
message = nfc.ndef.Message(data);
sel.add_carrier(message[0], "active", message[1:])
@@ -131,6 +135,9 @@ def wps_handover_resp(peer):
nfc.llcp.shutdown()
return
+ if srv.sent_carrier:
+ wpas_report_handover(srv.received_carrier, srv.sent_carrier)
+
print "Remove peer"
nfc.llcp.shutdown()
print "Done with handover"