dpp-nfc: Ignore (no) response to initial handover request
If an alternative proposal (second handover request) is sent, the response (or lack of it) to the initial handover request should be ignored. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
7d27bcb8e7
commit
e9c192ffc7
1 changed files with 13 additions and 1 deletions
|
@ -246,9 +246,11 @@ def wpas_report_handover_sel(uri):
|
||||||
|
|
||||||
def dpp_handover_client(llc, alt=False):
|
def dpp_handover_client(llc, alt=False):
|
||||||
chan_override = None
|
chan_override = None
|
||||||
|
global alt_proposal_used
|
||||||
if alt:
|
if alt:
|
||||||
global altchanlist
|
global altchanlist
|
||||||
chan_override = altchanlist
|
chan_override = altchanlist
|
||||||
|
alt_proposal_used = True
|
||||||
global test_uri, test_alt_uri
|
global test_uri, test_alt_uri
|
||||||
if test_uri:
|
if test_uri:
|
||||||
summary("TEST MODE: Using specified URI (alt=%s)" % str(alt))
|
summary("TEST MODE: Using specified URI (alt=%s)" % str(alt))
|
||||||
|
@ -318,12 +320,16 @@ def dpp_handover_client(llc, alt=False):
|
||||||
# This is fine if we are the handover selector
|
# This is fine if we are the handover selector
|
||||||
if hs_sent:
|
if hs_sent:
|
||||||
summary("Client receive failed as expected since I'm the handover server: %s" % str(e))
|
summary("Client receive failed as expected since I'm the handover server: %s" % str(e))
|
||||||
|
elif alt_proposal_used and not alt:
|
||||||
|
summary("Client received failed for initial proposal as expected since alternative proposal was also used: %s" % str(e))
|
||||||
else:
|
else:
|
||||||
summary("Client receive failed: %s" % str(e), color=C_RED)
|
summary("Client receive failed: %s" % str(e), color=C_RED)
|
||||||
message = None
|
message = None
|
||||||
if message is None:
|
if message is None:
|
||||||
if hs_sent:
|
if hs_sent:
|
||||||
summary("No response received as expected since I'm the handover server")
|
summary("No response received as expected since I'm the handover server")
|
||||||
|
elif alt_proposal_used and not alt:
|
||||||
|
summary("No response received for initial proposal as expected since alternative proposal was also used")
|
||||||
else:
|
else:
|
||||||
summary("No response received", color=C_RED)
|
summary("No response received", color=C_RED)
|
||||||
client.close()
|
client.close()
|
||||||
|
@ -338,6 +344,11 @@ def dpp_handover_client(llc, alt=False):
|
||||||
summary("Received handover select message")
|
summary("Received handover select message")
|
||||||
summary("alternative carriers: " + str(message[0].alternative_carriers))
|
summary("alternative carriers: " + str(message[0].alternative_carriers))
|
||||||
|
|
||||||
|
if alt_proposal_used and not alt:
|
||||||
|
summary("Ignore received handover select for the initial proposal since alternative proposal was sent")
|
||||||
|
client.close()
|
||||||
|
return
|
||||||
|
|
||||||
dpp_found = False
|
dpp_found = False
|
||||||
for carrier in message:
|
for carrier in message:
|
||||||
if isinstance(carrier, ndef.HandoverSelectRecord):
|
if isinstance(carrier, ndef.HandoverSelectRecord):
|
||||||
|
@ -784,13 +795,14 @@ def llcp_startup(llc):
|
||||||
def llcp_connected(llc):
|
def llcp_connected(llc):
|
||||||
summary("P2P LLCP connected")
|
summary("P2P LLCP connected")
|
||||||
global wait_connection, my_crn, peer_crn, my_crn_ready, hs_sent
|
global wait_connection, my_crn, peer_crn, my_crn_ready, hs_sent
|
||||||
global no_alt_proposal
|
global no_alt_proposal, alt_proposal_used
|
||||||
wait_connection = False
|
wait_connection = False
|
||||||
my_crn_ready = False
|
my_crn_ready = False
|
||||||
my_crn = None
|
my_crn = None
|
||||||
peer_crn = None
|
peer_crn = None
|
||||||
hs_sent = False
|
hs_sent = False
|
||||||
no_alt_proposal = False
|
no_alt_proposal = False
|
||||||
|
alt_proposal_used = False
|
||||||
global srv
|
global srv
|
||||||
srv.start()
|
srv.start()
|
||||||
if init_on_touch or not no_input:
|
if init_on_touch or not no_input:
|
||||||
|
|
Loading…
Reference in a new issue