]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dpp-nfc: Be more graceful when wpa_supplicant is not available
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 May 2020 21:31:32 +0000 (00:31 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 14 May 2020 21:31:32 +0000 (00:31 +0300)
Do not try to proceed with negotiated connection handover if
wpa_supplicant control interface is not available.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/examples/dpp-nfc.py

index cc32e4904d0e871695069a8495fd9e22572ab289..2f220f96427605fbcf5d97e6741580ff5da36a62 100755 (executable)
@@ -154,7 +154,10 @@ def dpp_bootstrap_gen(wpas, type="qrcode", chan=None, mac=None, info=None,
     if mac:
         if mac is True:
             mac = own_addr(wpas)
-        cmd += " mac=" + mac.replace(':', '')
+        if mac is None:
+            print("Could not determine local MAC address for bootstrap info")
+        else:
+            cmd += " mac=" + mac.replace(':', '')
     if info:
         cmd += " info=" + info
     if curve:
@@ -197,6 +200,9 @@ def wpas_report_handover_sel(uri):
 
 def dpp_handover_client(llc):
     uri = wpas_get_nfc_uri(start_listen=False)
+    if uri is None:
+        print("Cannot start handover client - no bootstrap URI available")
+        return
     uri = ndef.UriRecord(uri)
     print("NFC URI record for DPP: " + str(uri))
     carrier = ndef.Record('application/vnd.wfa.dpp', 'A', uri.data)