From 574a8fa6c84efad4f98df294cddbe102114e1bfd Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 12 Aug 2020 17:57:21 +0300 Subject: [PATCH] DPP: Do not interpret unknown channel as missing channel list for NFC While the listed unknown operating class/channel number pairs need to be ignored, that should be done in a manner than prevents the parsed bootstrapping info from being used as if it had no channel list (i.e., allowing any channel) if there are no known operating class/channel number pairs. Signed-off-by: Jouni Malinen --- src/common/dpp.c | 5 +++-- src/common/dpp.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/dpp.c b/src/common/dpp.c index de8a4a4ad..bc349229b 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -245,6 +245,7 @@ int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi, wpa_printf(MSG_DEBUG, "DPP: URI channel-list: opclass=%d channel=%d ==> freq=%d", opclass, channel, freq); + bi->channels_listed = true; if (freq < 0) { wpa_printf(MSG_DEBUG, "DPP: Ignore unknown URI channel-list channel (opclass=%d channel=%d)", @@ -4030,11 +4031,11 @@ static int dpp_nfc_update_bi_channel(struct dpp_bootstrap_info *own_bi, u8 op_class, channel; char chan[20]; - if (peer_bi->num_freq == 0) + if (peer_bi->num_freq == 0 && !peer_bi->channels_listed) return 0; /* no channel preference/constraint */ for (i = 0; i < peer_bi->num_freq; i++) { - if (own_bi->num_freq == 0 || + if ((own_bi->num_freq == 0 && !own_bi->channels_listed) || freq_included(own_bi->freq, own_bi->num_freq, peer_bi->freq[i])) { freq = peer_bi->freq[i]; diff --git a/src/common/dpp.h b/src/common/dpp.h index a8526b14d..9cf1019ae 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -153,6 +153,7 @@ struct dpp_bootstrap_info { char *pk; unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ]; unsigned int num_freq; + bool channels_listed; u8 version; int own; EVP_PKEY *pubkey;