DPP: Allow local channel list to be set

The new dpp-nfc.py command line argument --chan can be used to replace
the local channel list default (81/1).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-02-06 23:22:39 +02:00
parent 39a757c408
commit 61c049da3d

View file

@ -162,8 +162,8 @@ def wpas_get_nfc_uri(start_listen=True):
wpas = wpas_connect() wpas = wpas_connect()
if wpas is None: if wpas is None:
return None return None
global own_id global own_id, chanlist
own_id = dpp_bootstrap_gen(wpas, type="nfc-uri", chan="81/1", mac=True) own_id = dpp_bootstrap_gen(wpas, type="nfc-uri", chan=chanlist, mac=True)
res = wpas.request("DPP_BOOTSTRAP_GET_URI %d" % own_id).rstrip() res = wpas.request("DPP_BOOTSTRAP_GET_URI %d" % own_id).rstrip()
if "FAIL" in res: if "FAIL" in res:
return None return None
@ -579,6 +579,7 @@ def main():
parser.add_argument('--success', parser.add_argument('--success',
help='success file for writing success update') help='success file for writing success update')
parser.add_argument('--device', default='usb', help='NFC device to open') parser.add_argument('--device', default='usb', help='NFC device to open')
parser.add_argument('--chan', default='81/1', help='channel list')
parser.add_argument('command', choices=['write-nfc-uri', parser.add_argument('command', choices=['write-nfc-uri',
'write-nfc-hs'], 'write-nfc-hs'],
nargs='?') nargs='?')
@ -591,6 +592,9 @@ def main():
global no_wait global no_wait
no_wait = args.no_wait no_wait = args.no_wait
global chanlist
chanlist = args.chan
logging.basicConfig(level=args.loglevel) logging.basicConfig(level=args.loglevel)
global init_on_touch global init_on_touch