]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Do not interpret unknown channel as missing channel list for NFC
authorJouni Malinen <jouni@codeaurora.org>
Wed, 12 Aug 2020 14:57:21 +0000 (17:57 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 12 Aug 2020 15:06:28 +0000 (18:06 +0300)
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 <jouni@codeaurora.org>
src/common/dpp.c
src/common/dpp.h

index de8a4a4ad24b4ad272f1356a91aba01f343c1850..bc349229b7b2384788355c81287b5a69f2b3c2a0 100644 (file)
@@ -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];
index a8526b14d5984612f5025cdd7cc99c263a6ada01..9cf1019ae3e2e94e4c2b9762370a894ce78f0c0a 100644 (file)
@@ -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;