diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 25bf4e7e7..226acd691 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -124,7 +124,7 @@ static int wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s); static int wpas_p2p_num_unused_channels(struct wpa_supplicant *wpa_s) { int *freqs; - int num; + int num, unused; freqs = os_calloc(wpa_s->num_multichan_concurrent, sizeof(int)); if (!freqs) @@ -134,7 +134,9 @@ static int wpas_p2p_num_unused_channels(struct wpa_supplicant *wpa_s) wpa_s->num_multichan_concurrent); os_free(freqs); - return wpa_s->num_multichan_concurrent - num; + unused = wpa_s->num_multichan_concurrent - num; + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: num_unused_channels: %d", unused); + return unused; } @@ -164,6 +166,8 @@ static int wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s, os_free(freqs); + dump_freq_array(wpa_s, "valid for P2P", p2p_freqs, j); + return j; } diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c058a6e73..4388ad6b5 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4009,6 +4009,18 @@ int wpas_wpa_is_in_progress(struct wpa_supplicant *wpa_s, int include_current) } +void dump_freq_array(struct wpa_supplicant *wpa_s, const char *title, + int *freq_array, unsigned int len) +{ + unsigned int i; + + wpa_dbg(wpa_s, MSG_DEBUG, "Shared frequencies (len=%u): %s", + len, title); + for (i = 0; i < len; i++) + wpa_dbg(wpa_s, MSG_DEBUG, "freq[%u]: %d", i, freq_array[i]); +} + + /* * Find the operating frequencies of any of the virtual interfaces that * are using the same radio as the current interface. @@ -4022,6 +4034,8 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s, int freq; unsigned int idx = 0, i; + wpa_dbg(wpa_s, MSG_DEBUG, + "Determining shared radio frequencies (max len %u)", len); os_memset(freq_array, 0, sizeof(int) * len); /* First add the frequency of the local interface */ @@ -4039,12 +4053,16 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s, if (freq > 0 && idx < len && (idx == 0 || freq_array[0] != freq)) freq_array[idx++] = freq; + dump_freq_array(wpa_s, "No get_radio_name", freq_array, idx); return idx; } rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv); - if (rn == NULL || rn[0] == '\0') + if (rn == NULL || rn[0] == '\0') { + dump_freq_array(wpa_s, "get_radio_name failed", + freq_array, idx); return idx; + } for (ifs = wpa_s->global->ifaces; ifs && idx < len; ifs = ifs->next) { @@ -4074,5 +4092,7 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s, if (i == idx) freq_array[idx++] = freq; } + + dump_freq_array(wpa_s, "completed iteration", freq_array, idx); return idx; } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index da536cb20..eed1053ad 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -863,6 +863,8 @@ int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); int wpas_init_ext_pw(struct wpa_supplicant *wpa_s); +void dump_freq_array(struct wpa_supplicant *wpa_s, const char *title, + int *freq_array, unsigned int len); int get_shared_radio_freqs(struct wpa_supplicant *wpa_s, int *freq_array, unsigned int len);