Use wpa_msg() instead of wpa_printf()

This converts number of debugging messages to use wpa_msg() in order
to allow the interface name to be shown with the messages.

A new function, wpa_dbg(), is introduced to allow
CONFIG_NO_STDOUT_DEBUG=y builds to remove the debug strings. This is
otherwise identical with wpa_msg(), but it gets compiled out if stdout
debugging is disabled.
This commit is contained in:
Ben Greear 2011-02-10 20:14:46 +02:00 committed by Jouni Malinen
parent 2944824315
commit f049052b9e
7 changed files with 695 additions and 604 deletions

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@ enum {
#define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0) #define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
#define wpa_debug_open_file(p) do { } while (0) #define wpa_debug_open_file(p) do { } while (0)
#define wpa_debug_close_file() do { } while (0) #define wpa_debug_close_file() do { } while (0)
#define wpa_dbg(args...) do { } while (0)
#else /* CONFIG_NO_STDOUT_DEBUG */ #else /* CONFIG_NO_STDOUT_DEBUG */
@ -141,6 +142,14 @@ void wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
size_t len); size_t len);
/*
* wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
* binary size. As such, it should be used with debugging messages that are not
* needed in the control interface while wpa_msg() has to be used for anything
* that needs to shown to control interface monitors.
*/
#define wpa_dbg(args...) wpa_msg(args)
#endif /* CONFIG_NO_STDOUT_DEBUG */ #endif /* CONFIG_NO_STDOUT_DEBUG */

View file

@ -65,9 +65,9 @@ static void wpa_bss_remove(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
dl_list_del(&bss->list); dl_list_del(&bss->list);
dl_list_del(&bss->list_id); dl_list_del(&bss->list_id);
wpa_s->num_bss--; wpa_s->num_bss--;
wpa_printf(MSG_DEBUG, "BSS: Remove id %u BSSID " MACSTR " SSID '%s'", wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Remove id %u BSSID " MACSTR
bss->id, MAC2STR(bss->bssid), " SSID '%s'", bss->id, MAC2STR(bss->bssid),
wpa_ssid_txt(bss->ssid, bss->ssid_len)); wpa_ssid_txt(bss->ssid, bss->ssid_len));
wpas_notify_bss_removed(wpa_s, bss->bssid, bss->id); wpas_notify_bss_removed(wpa_s, bss->bssid, bss->id);
os_free(bss); os_free(bss);
} }
@ -133,8 +133,9 @@ static void wpa_bss_add(struct wpa_supplicant *wpa_s,
dl_list_add_tail(&wpa_s->bss, &bss->list); dl_list_add_tail(&wpa_s->bss, &bss->list);
dl_list_add_tail(&wpa_s->bss_id, &bss->list_id); dl_list_add_tail(&wpa_s->bss_id, &bss->list_id);
wpa_s->num_bss++; wpa_s->num_bss++;
wpa_printf(MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR " SSID '%s'", wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR
bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len)); " SSID '%s'",
bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len));
wpas_notify_bss_added(wpa_s, bss->bssid, bss->id); wpas_notify_bss_added(wpa_s, bss->bssid, bss->id);
if (wpa_s->num_bss > wpa_s->conf->bss_max_count) { if (wpa_s->num_bss > wpa_s->conf->bss_max_count) {
/* Remove the oldest entry */ /* Remove the oldest entry */
@ -317,8 +318,8 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
void wpa_bss_update_start(struct wpa_supplicant *wpa_s) void wpa_bss_update_start(struct wpa_supplicant *wpa_s)
{ {
wpa_s->bss_update_idx++; wpa_s->bss_update_idx++;
wpa_printf(MSG_DEBUG, "BSS: Start scan result update %u", wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Start scan result update %u",
wpa_s->bss_update_idx); wpa_s->bss_update_idx);
} }
@ -330,13 +331,13 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
ssid = wpa_scan_get_ie(res, WLAN_EID_SSID); ssid = wpa_scan_get_ie(res, WLAN_EID_SSID);
if (ssid == NULL) { if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "BSS: No SSID IE included for " MACSTR, wpa_dbg(wpa_s, MSG_DEBUG, "BSS: No SSID IE included for "
MAC2STR(res->bssid)); MACSTR, MAC2STR(res->bssid));
return; return;
} }
if (ssid[1] > 32) { if (ssid[1] > 32) {
wpa_printf(MSG_DEBUG, "BSS: Too long SSID IE included for " wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Too long SSID IE included for "
MACSTR, MAC2STR(res->bssid)); MACSTR, MAC2STR(res->bssid));
return; return;
} }
@ -412,8 +413,8 @@ void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info,
if (bss->last_update_idx < wpa_s->bss_update_idx) if (bss->last_update_idx < wpa_s->bss_update_idx)
bss->scan_miss_count++; bss->scan_miss_count++;
if (bss->scan_miss_count >= WPA_BSS_EXPIRATION_SCAN_COUNT) { if (bss->scan_miss_count >= WPA_BSS_EXPIRATION_SCAN_COUNT) {
wpa_printf(MSG_DEBUG, "BSS: Expire BSS %u due to no " wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Expire BSS %u due to "
"match in scan", bss->id); "no match in scan", bss->id);
wpa_bss_remove(wpa_s, bss); wpa_bss_remove(wpa_s, bss);
} }
} }
@ -437,8 +438,8 @@ static void wpa_bss_timeout(void *eloop_ctx, void *timeout_ctx)
continue; continue;
if (os_time_before(&bss->last_update, &t)) { if (os_time_before(&bss->last_update, &t)) {
wpa_printf(MSG_DEBUG, "BSS: Expire BSS %u due to age", wpa_dbg(wpa_s, MSG_DEBUG, "BSS: Expire BSS %u due to "
bss->id); "age", bss->id);
wpa_bss_remove(wpa_s, bss); wpa_bss_remove(wpa_s, bss);
} else } else
break; break;

View file

@ -53,22 +53,22 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
return 0; return 0;
wpa_printf(MSG_DEBUG, "Select network based on association " wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association "
"information"); "information");
ssid = wpa_supplicant_get_ssid(wpa_s); ssid = wpa_supplicant_get_ssid(wpa_s);
if (ssid == NULL) { if (ssid == NULL) {
wpa_printf(MSG_INFO, "No network configuration found for the " wpa_msg(wpa_s, MSG_INFO,
"current AP"); "No network configuration found for the current AP");
return -1; return -1;
} }
if (ssid->disabled) { if (ssid->disabled) {
wpa_printf(MSG_DEBUG, "Selected network is disabled"); wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is disabled");
return -1; return -1;
} }
wpa_printf(MSG_DEBUG, "Network configuration found for the current " wpa_dbg(wpa_s, MSG_DEBUG, "Network configuration found for the "
"AP"); "current AP");
if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X | if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X |
WPA_KEY_MGMT_WPA_NONE | WPA_KEY_MGMT_WPA_NONE |
WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_FT_IEEE8021X |
@ -153,8 +153,8 @@ static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
} }
} }
wpa_printf(MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from PMKSA " wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from "
"cache", pmksa_set == 0 ? "" : "not "); "PMKSA cache", pmksa_set == 0 ? "" : "not ");
} }
@ -162,14 +162,15 @@ static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s,
union wpa_event_data *data) union wpa_event_data *data)
{ {
if (data == NULL) { if (data == NULL) {
wpa_printf(MSG_DEBUG, "RSN: No data in PMKID candidate event"); wpa_dbg(wpa_s, MSG_DEBUG, "RSN: No data in PMKID candidate "
"event");
return; return;
} }
wpa_printf(MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR
" index=%d preauth=%d", " index=%d preauth=%d",
MAC2STR(data->pmkid_candidate.bssid), MAC2STR(data->pmkid_candidate.bssid),
data->pmkid_candidate.index, data->pmkid_candidate.index,
data->pmkid_candidate.preauth); data->pmkid_candidate.preauth);
pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid, pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid,
data->pmkid_candidate.index, data->pmkid_candidate.index,
@ -240,13 +241,14 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
aka = 0; aka = 0;
if (!sim && !aka) { if (!sim && !aka) {
wpa_printf(MSG_DEBUG, "Selected network is configured to use " wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to "
"SIM, but neither EAP-SIM nor EAP-AKA are enabled"); "use SIM, but neither EAP-SIM nor EAP-AKA are "
"enabled");
return 0; return 0;
} }
wpa_printf(MSG_DEBUG, "Selected network is configured to use SIM " wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM "
"(sim=%d aka=%d) - initialize PCSC", sim, aka); "(sim=%d aka=%d) - initialize PCSC", sim, aka);
if (sim && aka) if (sim && aka)
type = SCARD_TRY_BOTH; type = SCARD_TRY_BOTH;
else if (aka) else if (aka)
@ -256,8 +258,8 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
wpa_s->scard = scard_init(type); wpa_s->scard = scard_init(type);
if (wpa_s->scard == NULL) { if (wpa_s->scard == NULL) {
wpa_printf(MSG_WARNING, "Failed to initialize SIM " wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM "
"(pcsc-lite)"); "(pcsc-lite)");
return -1; return -1;
} }
wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard); wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard);
@ -326,52 +328,53 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
proto_match++; proto_match++;
if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) { if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
wpa_printf(MSG_DEBUG, " skip RSN IE - parse failed"); wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - parse "
"failed");
break; break;
} }
if (wep_ok && if (wep_ok &&
(ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104))) (ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104)))
{ {
wpa_printf(MSG_DEBUG, " selected based on TSN in " wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
"RSN IE"); "in RSN IE");
return 1; return 1;
} }
if (!(ie.proto & ssid->proto)) { if (!(ie.proto & ssid->proto)) {
wpa_printf(MSG_DEBUG, " skip RSN IE - proto " wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - proto "
"mismatch"); "mismatch");
break; break;
} }
if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) { if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
wpa_printf(MSG_DEBUG, " skip RSN IE - PTK cipher " wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - PTK "
"mismatch"); "cipher mismatch");
break; break;
} }
if (!(ie.group_cipher & ssid->group_cipher)) { if (!(ie.group_cipher & ssid->group_cipher)) {
wpa_printf(MSG_DEBUG, " skip RSN IE - GTK cipher " wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - GTK "
"mismatch"); "cipher mismatch");
break; break;
} }
if (!(ie.key_mgmt & ssid->key_mgmt)) { if (!(ie.key_mgmt & ssid->key_mgmt)) {
wpa_printf(MSG_DEBUG, " skip RSN IE - key mgmt " wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - key mgmt "
"mismatch"); "mismatch");
break; break;
} }
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
if (!(ie.capabilities & WPA_CAPABILITY_MFPC) && if (!(ie.capabilities & WPA_CAPABILITY_MFPC) &&
ssid->ieee80211w == MGMT_FRAME_PROTECTION_REQUIRED) { ssid->ieee80211w == MGMT_FRAME_PROTECTION_REQUIRED) {
wpa_printf(MSG_DEBUG, " skip RSN IE - no mgmt frame " wpa_dbg(wpa_s, MSG_DEBUG, " skip RSN IE - no mgmt "
"protection"); "frame protection");
break; break;
} }
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
wpa_printf(MSG_DEBUG, " selected based on RSN IE"); wpa_dbg(wpa_s, MSG_DEBUG, " selected based on RSN IE");
return 1; return 1;
} }
@ -380,49 +383,50 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
proto_match++; proto_match++;
if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) { if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
wpa_printf(MSG_DEBUG, " skip WPA IE - parse failed"); wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - parse "
"failed");
break; break;
} }
if (wep_ok && if (wep_ok &&
(ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104))) (ie.group_cipher & (WPA_CIPHER_WEP40 | WPA_CIPHER_WEP104)))
{ {
wpa_printf(MSG_DEBUG, " selected based on TSN in " wpa_dbg(wpa_s, MSG_DEBUG, " selected based on TSN "
"WPA IE"); "in WPA IE");
return 1; return 1;
} }
if (!(ie.proto & ssid->proto)) { if (!(ie.proto & ssid->proto)) {
wpa_printf(MSG_DEBUG, " skip WPA IE - proto " wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - proto "
"mismatch"); "mismatch");
break; break;
} }
if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) { if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
wpa_printf(MSG_DEBUG, " skip WPA IE - PTK cipher " wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - PTK "
"mismatch"); "cipher mismatch");
break; break;
} }
if (!(ie.group_cipher & ssid->group_cipher)) { if (!(ie.group_cipher & ssid->group_cipher)) {
wpa_printf(MSG_DEBUG, " skip WPA IE - GTK cipher " wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - GTK "
"mismatch"); "cipher mismatch");
break; break;
} }
if (!(ie.key_mgmt & ssid->key_mgmt)) { if (!(ie.key_mgmt & ssid->key_mgmt)) {
wpa_printf(MSG_DEBUG, " skip WPA IE - key mgmt " wpa_dbg(wpa_s, MSG_DEBUG, " skip WPA IE - key mgmt "
"mismatch"); "mismatch");
break; break;
} }
wpa_printf(MSG_DEBUG, " selected based on WPA IE"); wpa_dbg(wpa_s, MSG_DEBUG, " selected based on WPA IE");
return 1; return 1;
} }
if ((ssid->proto & (WPA_PROTO_WPA | WPA_PROTO_RSN)) && if ((ssid->proto & (WPA_PROTO_WPA | WPA_PROTO_RSN)) &&
wpa_key_mgmt_wpa(ssid->key_mgmt) && proto_match == 0) { wpa_key_mgmt_wpa(ssid->key_mgmt) && proto_match == 0) {
wpa_printf(MSG_DEBUG, " skip - no WPA/RSN proto match"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - no WPA/RSN proto match");
return 0; return 0;
} }
@ -466,12 +470,11 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
ie = wpa_scan_get_ie(bss, WLAN_EID_RSN); ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
rsn_ie_len = ie ? ie[1] : 0; rsn_ie_len = ie ? ie[1] : 0;
wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' " wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
"wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d%s", "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x level=%d%s",
i, MAC2STR(bss->bssid), wpa_ssid_txt(ssid_, ssid_len), i, MAC2STR(bss->bssid), wpa_ssid_txt(ssid_, ssid_len),
wpa_ie_len, rsn_ie_len, bss->caps, bss->level, wpa_ie_len, rsn_ie_len, bss->caps, bss->level,
wpa_scan_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ? wpa_scan_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE) ? " wps" : "");
" wps" : "");
e = wpa_blacklist_get(wpa_s, bss->bssid); e = wpa_blacklist_get(wpa_s, bss->bssid);
if (e) { if (e) {
@ -488,14 +491,14 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
limit = 0; limit = 0;
} }
if (e->count > limit) { if (e->count > limit) {
wpa_printf(MSG_DEBUG, " skip - blacklisted " wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
"(count=%d limit=%d)", e->count, limit); "(count=%d limit=%d)", e->count, limit);
return 0; return 0;
} }
} }
if (ssid_len == 0) { if (ssid_len == 0) {
wpa_printf(MSG_DEBUG, " skip - SSID not known"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known");
return 0; return 0;
} }
@ -505,13 +508,14 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
int check_ssid = wpa ? 1 : (ssid->ssid_len != 0); int check_ssid = wpa ? 1 : (ssid->ssid_len != 0);
if (ssid->disabled) { if (ssid->disabled) {
wpa_printf(MSG_DEBUG, " skip - disabled"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled");
continue; continue;
} }
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && e && e->count > 0) { if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && e && e->count > 0) {
wpa_printf(MSG_DEBUG, " skip - blacklisted (WPS)"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - blacklisted "
"(WPS)");
continue; continue;
} }
@ -533,13 +537,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
if (check_ssid && if (check_ssid &&
(ssid_len != ssid->ssid_len || (ssid_len != ssid->ssid_len ||
os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) { os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
wpa_printf(MSG_DEBUG, " skip - SSID mismatch"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID mismatch");
continue; continue;
} }
if (ssid->bssid_set && if (ssid->bssid_set &&
os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0) { os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0) {
wpa_printf(MSG_DEBUG, " skip - BSSID mismatch"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID mismatch");
continue; continue;
} }
@ -550,25 +554,26 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) && !(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
!(ssid->key_mgmt & WPA_KEY_MGMT_WPS) && !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
!(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) { !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) {
wpa_printf(MSG_DEBUG, " skip - non-WPA network not " wpa_dbg(wpa_s, MSG_DEBUG, " skip - non-WPA network "
"allowed"); "not allowed");
continue; continue;
} }
if (!wpa && !wpa_supplicant_match_privacy(bss, ssid)) { if (!wpa && !wpa_supplicant_match_privacy(bss, ssid)) {
wpa_printf(MSG_DEBUG, " skip - privacy mismatch"); wpa_dbg(wpa_s, MSG_DEBUG, " skip - privacy "
"mismatch");
continue; continue;
} }
if (!wpa && (bss->caps & IEEE80211_CAP_IBSS)) { if (!wpa && (bss->caps & IEEE80211_CAP_IBSS)) {
wpa_printf(MSG_DEBUG, " skip - IBSS (adhoc) " wpa_dbg(wpa_s, MSG_DEBUG, " skip - IBSS (adhoc) "
"network"); "network");
continue; continue;
} }
if (!freq_allowed(ssid->freq_list, bss->freq)) { if (!freq_allowed(ssid->freq_list, bss->freq)) {
wpa_printf(MSG_DEBUG, " skip - frequency not " wpa_dbg(wpa_s, MSG_DEBUG, " skip - frequency not "
"allowed"); "allowed");
continue; continue;
} }
@ -597,8 +602,8 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
{ {
size_t i; size_t i;
wpa_printf(MSG_DEBUG, "Selecting BSS from priority group %d", wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d",
group->priority); group->priority);
for (i = 0; i < scan_res->num; i++) { for (i = 0; i < scan_res->num; i++) {
struct wpa_scan_res *bss = scan_res->res[i]; struct wpa_scan_res *bss = scan_res->res[i];
@ -613,8 +618,9 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s,
ssid = ie ? ie + 2 : (u8 *) ""; ssid = ie ? ie + 2 : (u8 *) "";
ssid_len = ie ? ie[1] : 0; ssid_len = ie ? ie[1] : 0;
wpa_printf(MSG_DEBUG, " selected BSS " MACSTR " ssid='%s'", wpa_dbg(wpa_s, MSG_DEBUG, " selected BSS " MACSTR
MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len)); " ssid='%s'",
MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len));
return wpa_bss_get(wpa_s, bss->bssid, ssid, ssid_len); return wpa_bss_get(wpa_s, bss->bssid, ssid, ssid_len);
} }
@ -640,8 +646,8 @@ wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
} }
if (selected == NULL && wpa_s->blacklist) { if (selected == NULL && wpa_s->blacklist) {
wpa_printf(MSG_DEBUG, "No APs found - clear blacklist " wpa_dbg(wpa_s, MSG_DEBUG, "No APs found - clear "
"and try again"); "blacklist and try again");
wpa_blacklist_clear(wpa_s); wpa_blacklist_clear(wpa_s);
wpa_s->blacklist_cleared++; wpa_s->blacklist_cleared++;
} else if (selected == NULL) } else if (selected == NULL)
@ -702,8 +708,8 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
} }
wpa_supplicant_associate(wpa_s, selected, ssid); wpa_supplicant_associate(wpa_s, selected, ssid);
} else { } else {
wpa_printf(MSG_DEBUG, "Already associated with the selected " wpa_dbg(wpa_s, MSG_DEBUG, "Already associated with the "
"AP"); "selected AP");
} }
} }
@ -795,17 +801,17 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
if (!current_bss) if (!current_bss)
return 1; /* current BSS not seen in scan results */ return 1; /* current BSS not seen in scan results */
wpa_printf(MSG_DEBUG, "Considering within-ESS reassociation"); wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
wpa_printf(MSG_DEBUG, "Current BSS: " MACSTR " level=%d", wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR " level=%d",
MAC2STR(current_bss->bssid), current_bss->level); MAC2STR(current_bss->bssid), current_bss->level);
wpa_printf(MSG_DEBUG, "Selected BSS: " MACSTR " level=%d", wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR " level=%d",
MAC2STR(selected->bssid), selected->level); MAC2STR(selected->bssid), selected->level);
if (wpa_s->current_ssid->bssid_set && if (wpa_s->current_ssid->bssid_set &&
os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) == os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) ==
0) { 0) {
wpa_printf(MSG_DEBUG, "Allow reassociation - selected BSS has " wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS "
"preferred BSSID"); "has preferred BSSID");
return 1; return 1;
} }
@ -823,8 +829,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
min_diff = 5; min_diff = 5;
} }
if (abs(current_bss->level - selected->level) < min_diff) { if (abs(current_bss->level - selected->level) < min_diff) {
wpa_printf(MSG_DEBUG, "Skip roam - too small difference in " wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - too small difference "
"signal level"); "in signal level");
return 0; return 0;
} }
@ -853,8 +859,8 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (scan_res == NULL) { if (scan_res == NULL) {
if (wpa_s->conf->ap_scan == 2 || ap) if (wpa_s->conf->ap_scan == 2 || ap)
return; return;
wpa_printf(MSG_DEBUG, "Failed to get scan results - try " wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results - try "
"scanning again"); "scanning again");
wpa_supplicant_req_new_scan(wpa_s, 1, 0); wpa_supplicant_req_new_scan(wpa_s, 1, 0);
return; return;
} }
@ -889,12 +895,12 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
} }
if (ap) { if (ap) {
wpa_printf(MSG_DEBUG, "Ignore scan results in AP mode"); wpa_dbg(wpa_s, MSG_DEBUG, "Ignore scan results in AP mode");
wpa_scan_results_free(scan_res); wpa_scan_results_free(scan_res);
return; return;
} }
wpa_printf(MSG_DEBUG, "%s: New scan results available", wpa_s->ifname); wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available");
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS); wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
wpas_notify_scan_results(wpa_s); wpas_notify_scan_results(wpa_s);
@ -930,10 +936,10 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
wpa_supplicant_connect(wpa_s, selected, ssid); wpa_supplicant_connect(wpa_s, selected, ssid);
} else { } else {
wpa_scan_results_free(scan_res); wpa_scan_results_free(scan_res);
wpa_printf(MSG_DEBUG, "No suitable network found"); wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found");
ssid = wpa_supplicant_pick_new_network(wpa_s); ssid = wpa_supplicant_pick_new_network(wpa_s);
if (ssid) { if (ssid) {
wpa_printf(MSG_DEBUG, "Setup a new network"); wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network");
wpa_supplicant_associate(wpa_s, NULL, ssid); wpa_supplicant_associate(wpa_s, NULL, ssid);
} else { } else {
int timeout_sec = 5; int timeout_sec = 5;
@ -974,9 +980,8 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
if (rn == NULL || rn[0] == '\0') if (rn == NULL || rn[0] == '\0')
return; return;
wpa_printf(MSG_DEBUG, "%s: Checking for other virtual interfaces " wpa_dbg(wpa_s, MSG_DEBUG, "Checking for other virtual interfaces "
"sharing same radio (%s) in event_scan_results", "sharing same radio (%s) in event_scan_results", rn);
wpa_s->ifname, rn);
for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) { for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
if (ifs == wpa_s || !ifs->driver->get_radio_name) if (ifs == wpa_s || !ifs->driver->get_radio_name)
@ -1000,7 +1005,7 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
int l, len, found = 0, wpa_found, rsn_found; int l, len, found = 0, wpa_found, rsn_found;
const u8 *p; const u8 *p;
wpa_printf(MSG_DEBUG, "Association info event"); wpa_dbg(wpa_s, MSG_DEBUG, "Association info event");
if (data->assoc_info.req_ies) if (data->assoc_info.req_ies)
wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies, wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies,
data->assoc_info.req_ies_len); data->assoc_info.req_ies_len);
@ -1012,7 +1017,8 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
data->assoc_info.beacon_ies, data->assoc_info.beacon_ies,
data->assoc_info.beacon_ies_len); data->assoc_info.beacon_ies_len);
if (data->assoc_info.freq) if (data->assoc_info.freq)
wpa_printf(MSG_DEBUG, "freq=%u MHz", data->assoc_info.freq); wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz",
data->assoc_info.freq);
p = data->assoc_info.req_ies; p = data->assoc_info.req_ies;
l = data->assoc_info.req_ies_len; l = data->assoc_info.req_ies_len;
@ -1049,8 +1055,8 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
data->assoc_info.resp_ies, data->assoc_info.resp_ies,
data->assoc_info.resp_ies_len, data->assoc_info.resp_ies_len,
bssid) < 0) { bssid) < 0) {
wpa_printf(MSG_DEBUG, "FT: Validation of " wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of "
"Reassociation Response failed"); "Reassociation Response failed");
wpa_supplicant_deauthenticate( wpa_supplicant_deauthenticate(
wpa_s, WLAN_REASON_INVALID_IE); wpa_s, WLAN_REASON_INVALID_IE);
return -1; return -1;
@ -1066,8 +1072,8 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
struct wpabuf *wps; struct wpabuf *wps;
wps = ieee802_11_vendor_ie_concat(p, l, WPS_IE_VENDOR_TYPE); wps = ieee802_11_vendor_ie_concat(p, l, WPS_IE_VENDOR_TYPE);
if (wps == NULL) { if (wps == NULL) {
wpa_printf(MSG_INFO, "WPS-STRICT: AP did not include " wpa_msg(wpa_s, MSG_INFO, "WPS-STRICT: AP did not "
"WPS IE in (Re)Association Response"); "include WPS IE in (Re)Association Response");
return -1; return -1;
} }
@ -1177,7 +1183,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) || if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||
(wpa_drv_get_bssid(wpa_s, bssid) >= 0 && (wpa_drv_get_bssid(wpa_s, bssid) >= 0 &&
os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) { os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {
wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID=" wpa_dbg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
MACSTR, MAC2STR(bssid)); MACSTR, MAC2STR(bssid));
random_add_randomness(bssid, ETH_ALEN); random_add_randomness(bssid, ETH_ALEN);
bssid_changed = os_memcmp(wpa_s->bssid, bssid, ETH_ALEN); bssid_changed = os_memcmp(wpa_s->bssid, bssid, ETH_ALEN);
@ -1280,9 +1286,9 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
if (age.sec == 0 && age.usec < 100000 && if (age.sec == 0 && age.usec < 100000 &&
os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) == os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) ==
0) { 0) {
wpa_printf(MSG_DEBUG, "Process pending EAPOL frame " wpa_dbg(wpa_s, MSG_DEBUG, "Process pending EAPOL "
"that was received just before association " "frame that was received just before "
"notification"); "association notification");
wpa_supplicant_rx_eapol( wpa_supplicant_rx_eapol(
wpa_s, wpa_s->pending_eapol_rx_src, wpa_s, wpa_s->pending_eapol_rx_src,
wpabuf_head(wpa_s->pending_eapol_rx), wpabuf_head(wpa_s->pending_eapol_rx),
@ -1297,8 +1303,8 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
bgscan_deinit(wpa_s); bgscan_deinit(wpa_s);
if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) { if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) {
if (bgscan_init(wpa_s, wpa_s->current_ssid)) { if (bgscan_init(wpa_s, wpa_s->current_ssid)) {
wpa_printf(MSG_DEBUG, "Failed to initialize " wpa_dbg(wpa_s, MSG_DEBUG, "Failed to "
"bgscan"); "initialize bgscan");
/* /*
* Live without bgscan; it is only used as a * Live without bgscan; it is only used as a
* roaming optimization, so the initial * roaming optimization, so the initial
@ -1347,8 +1353,8 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
* generating streams of disconnected events when configuring * generating streams of disconnected events when configuring
* IBSS for WPA-None. Ignore them for now. * IBSS for WPA-None. Ignore them for now.
*/ */
wpa_printf(MSG_DEBUG, "Disconnect event - ignore in " wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - ignore in "
"IBSS/WPA-None mode"); "IBSS/WPA-None mode");
return; return;
} }
@ -1359,14 +1365,14 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
} }
if (!wpa_s->auto_reconnect_disabled || if (!wpa_s->auto_reconnect_disabled ||
wpa_s->key_mgmt == WPA_KEY_MGMT_WPS) { wpa_s->key_mgmt == WPA_KEY_MGMT_WPS) {
wpa_printf(MSG_DEBUG, "WPA: Auto connect enabled: try to " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Auto connect enabled: try to "
"reconnect (wps=%d)", "reconnect (wps=%d)",
wpa_s->key_mgmt == WPA_KEY_MGMT_WPS); wpa_s->key_mgmt == WPA_KEY_MGMT_WPS);
if (wpa_s->wpa_state >= WPA_ASSOCIATING) if (wpa_s->wpa_state >= WPA_ASSOCIATING)
wpa_supplicant_req_scan(wpa_s, 0, 100000); wpa_supplicant_req_scan(wpa_s, 0, 100000);
} else { } else {
wpa_printf(MSG_DEBUG, "WPA: Auto connect disabled: do not try " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Auto connect disabled: do not "
"to re-connect"); "try to re-connect");
wpa_s->reassociate = 0; wpa_s->reassociate = 0;
wpa_s->disconnected = 1; wpa_s->disconnected = 1;
} }
@ -1379,7 +1385,7 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
" reason=%d", " reason=%d",
MAC2STR(bssid), reason_code); MAC2STR(bssid), reason_code);
if (wpa_supplicant_dynamic_keys(wpa_s)) { if (wpa_supplicant_dynamic_keys(wpa_s)) {
wpa_printf(MSG_DEBUG, "Disconnect event - remove keys"); wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys");
wpa_s->keys_cleared = 0; wpa_s->keys_cleared = 0;
wpa_clear_keys(wpa_s, wpa_s->bssid); wpa_clear_keys(wpa_s, wpa_s->bssid);
} }
@ -1394,8 +1400,8 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
* requires us to remain in authenticating state to allow the * requires us to remain in authenticating state to allow the
* second authentication attempt to be continued properly. * second authentication attempt to be continued properly.
*/ */
wpa_printf(MSG_DEBUG, "SME: Allow pending authentication to " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication "
"proceed after disconnection event"); "to proceed after disconnection event");
wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);
os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN); os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN);
} }
@ -1412,7 +1418,7 @@ static void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx,
if (!wpa_s->pending_mic_error_report) if (!wpa_s->pending_mic_error_report)
return; return;
wpa_printf(MSG_DEBUG, "WPA: Sending pending MIC error report"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Sending pending MIC error report");
wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise); wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise);
wpa_s->pending_mic_error_report = 0; wpa_s->pending_mic_error_report = 0;
} }
@ -1487,8 +1493,8 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
sec = os_random() % 60; sec = os_random() % 60;
else else
sec = WPA_GET_BE32(rval) % 60; sec = WPA_GET_BE32(rval) % 60;
wpa_printf(MSG_DEBUG, "WPA: Delay MIC error report %d " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Delay MIC error "
"seconds", sec); "report %d seconds", sec);
wpa_s->pending_mic_error_report = 1; wpa_s->pending_mic_error_report = 1;
wpa_s->pending_mic_error_pairwise = pairwise; wpa_s->pending_mic_error_pairwise = pairwise;
eloop_cancel_timeout( eloop_cancel_timeout(
@ -1535,14 +1541,14 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
if (!wpa_s->interface_removed) if (!wpa_s->interface_removed)
break; break;
wpa_s->interface_removed = 0; wpa_s->interface_removed = 0;
wpa_printf(MSG_DEBUG, "Configured interface was added."); wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was added");
if (wpa_supplicant_driver_init(wpa_s) < 0) { if (wpa_supplicant_driver_init(wpa_s) < 0) {
wpa_printf(MSG_INFO, "Failed to initialize the driver " wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
"after interface was added."); "driver after interface was added");
} }
break; break;
case EVENT_INTERFACE_REMOVED: case EVENT_INTERFACE_REMOVED:
wpa_printf(MSG_DEBUG, "Configured interface was removed."); wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
wpa_s->interface_removed = 1; wpa_s->interface_removed = 1;
wpa_supplicant_mark_disassoc(wpa_s); wpa_supplicant_mark_disassoc(wpa_s);
l2_packet_deinit(wpa_s->l2); l2_packet_deinit(wpa_s->l2);
@ -1624,19 +1630,19 @@ static void ft_rx_action(struct wpa_supplicant *wpa_s, const u8 *data,
sta_addr = data + 1; sta_addr = data + 1;
target_ap_addr = data + 1 + ETH_ALEN; target_ap_addr = data + 1 + ETH_ALEN;
status = WPA_GET_LE16(data + 1 + 2 * ETH_ALEN); status = WPA_GET_LE16(data + 1 + 2 * ETH_ALEN);
wpa_printf(MSG_DEBUG, "FT: Received FT Action Response: STA " MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "FT: Received FT Action Response: STA "
" TargetAP " MACSTR " status %u", MACSTR " TargetAP " MACSTR " status %u",
MAC2STR(sta_addr), MAC2STR(target_ap_addr), status); MAC2STR(sta_addr), MAC2STR(target_ap_addr), status);
if (os_memcmp(sta_addr, wpa_s->own_addr, ETH_ALEN) != 0) { if (os_memcmp(sta_addr, wpa_s->own_addr, ETH_ALEN) != 0) {
wpa_printf(MSG_DEBUG, "FT: Foreign STA Address " MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "FT: Foreign STA Address " MACSTR
" in FT Action Response", MAC2STR(sta_addr)); " in FT Action Response", MAC2STR(sta_addr));
return; return;
} }
if (status) { if (status) {
wpa_printf(MSG_DEBUG, "FT: FT Action Response indicates " wpa_dbg(wpa_s, MSG_DEBUG, "FT: FT Action Response indicates "
"failure (status code %d)", status); "failure (status code %d)", status);
/* TODO: report error to FT code(?) */ /* TODO: report error to FT code(?) */
return; return;
} }
@ -1696,13 +1702,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED && if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED &&
event != EVENT_INTERFACE_ENABLED && event != EVENT_INTERFACE_ENABLED &&
event != EVENT_INTERFACE_STATUS) { event != EVENT_INTERFACE_STATUS) {
wpa_printf(MSG_DEBUG, "Ignore event %d while interface is " wpa_dbg(wpa_s, MSG_DEBUG, "Ignore event %d while interface is "
"disabled", event); "disabled", event);
return; return;
} }
wpa_printf(MSG_DEBUG, "Event %d received on interface %s", wpa_dbg(wpa_s, MSG_DEBUG, "Event %d received on interface %s",
event, wpa_s->ifname); event, wpa_s->ifname);
switch (event) { switch (event) {
case EVENT_AUTH: case EVENT_AUTH:
@ -1712,13 +1718,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
wpa_supplicant_event_assoc(wpa_s, data); wpa_supplicant_event_assoc(wpa_s, data);
break; break;
case EVENT_DISASSOC: case EVENT_DISASSOC:
wpa_printf(MSG_DEBUG, "Disassociation notification"); wpa_dbg(wpa_s, MSG_DEBUG, "Disassociation notification");
if (data) { if (data) {
wpa_printf(MSG_DEBUG, " * reason %u", wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u",
data->disassoc_info.reason_code); data->disassoc_info.reason_code);
if (data->disassoc_info.addr) if (data->disassoc_info.addr)
wpa_printf(MSG_DEBUG, " * address " MACSTR, wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR,
MAC2STR(data->disassoc_info.addr)); MAC2STR(data->disassoc_info.addr));
} }
#ifdef CONFIG_AP #ifdef CONFIG_AP
if (wpa_s->ap_iface && data && data->disassoc_info.addr) { if (wpa_s->ap_iface && data && data->disassoc_info.addr) {
@ -1744,16 +1750,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
/* fall through */ /* fall through */
case EVENT_DEAUTH: case EVENT_DEAUTH:
if (event == EVENT_DEAUTH) { if (event == EVENT_DEAUTH) {
wpa_printf(MSG_DEBUG, "Deauthentication notification"); wpa_dbg(wpa_s, MSG_DEBUG,
"Deauthentication notification");
if (data) { if (data) {
reason_code = data->deauth_info.reason_code; reason_code = data->deauth_info.reason_code;
wpa_printf(MSG_DEBUG, " * reason %u", wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u",
data->deauth_info.reason_code); data->deauth_info.reason_code);
if (data->deauth_info.addr) { if (data->deauth_info.addr) {
wpa_printf(MSG_DEBUG, " * address " wpa_dbg(wpa_s, MSG_DEBUG, " * address "
MACSTR, MACSTR,
MAC2STR(data->deauth_info. MAC2STR(data->deauth_info.
addr)); addr));
} }
wpa_hexdump(MSG_DEBUG, wpa_hexdump(MSG_DEBUG,
"Deauthentication frame IE(s)", "Deauthentication frame IE(s)",
@ -1832,10 +1839,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break; break;
#ifdef CONFIG_AP #ifdef CONFIG_AP
case EVENT_TX_STATUS: case EVENT_TX_STATUS:
wpa_printf(MSG_DEBUG, "EVENT_TX_STATUS on %s dst=" MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS dst=" MACSTR
" type=%d stype=%d", " type=%d stype=%d",
wpa_s->ifname, MAC2STR(data->tx_status.dst), MAC2STR(data->tx_status.dst),
data->tx_status.type, data->tx_status.stype); data->tx_status.type, data->tx_status.stype);
if (wpa_s->ap_iface == NULL) { if (wpa_s->ap_iface == NULL) {
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (data->tx_status.type == WLAN_FC_TYPE_MGMT && if (data->tx_status.type == WLAN_FC_TYPE_MGMT &&
@ -1851,8 +1858,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break; break;
} }
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
wpa_printf(MSG_DEBUG, "EVENT_TX_STATUS pending_dst=" MACSTR, wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS pending_dst="
MAC2STR(wpa_s->parent->pending_action_dst)); MACSTR, MAC2STR(wpa_s->parent->pending_action_dst));
/* /*
* Catch TX status events for Action frames we sent via group * Catch TX status events for Action frames we sent via group
* interface in GO mode. * interface in GO mode.
@ -1912,19 +1919,19 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break; break;
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
wpa_printf(MSG_DEBUG, "AP: ignore received management " wpa_dbg(wpa_s, MSG_DEBUG, "AP: ignore received "
"frame in non-AP mode"); "management frame in non-AP mode");
break; break;
} }
ap_mgmt_rx(wpa_s, &data->rx_mgmt); ap_mgmt_rx(wpa_s, &data->rx_mgmt);
break; break;
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
case EVENT_RX_ACTION: case EVENT_RX_ACTION:
wpa_printf(MSG_DEBUG, "Received Action frame: SA=" MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "Received Action frame: SA=" MACSTR
" Category=%u DataLen=%d freq=%d MHz", " Category=%u DataLen=%d freq=%d MHz",
MAC2STR(data->rx_action.sa), MAC2STR(data->rx_action.sa),
data->rx_action.category, (int) data->rx_action.len, data->rx_action.category, (int) data->rx_action.len,
data->rx_action.freq); data->rx_action.freq);
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
if (data->rx_action.category == WLAN_ACTION_FT) { if (data->rx_action.category == WLAN_ACTION_FT) {
ft_rx_action(wpa_s, data->rx_action.data, ft_rx_action(wpa_s, data->rx_action.data,
@ -2047,7 +2054,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->signal_change.current_txrate); data->signal_change.current_txrate);
break; break;
case EVENT_INTERFACE_ENABLED: case EVENT_INTERFACE_ENABLED:
wpa_printf(MSG_DEBUG, "Interface was enabled"); wpa_dbg(wpa_s, MSG_DEBUG, "Interface was enabled");
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
#ifdef CONFIG_AP #ifdef CONFIG_AP
if (!wpa_s->ap_iface) { if (!wpa_s->ap_iface) {
@ -2064,7 +2071,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
} }
break; break;
case EVENT_INTERFACE_DISABLED: case EVENT_INTERFACE_DISABLED:
wpa_printf(MSG_DEBUG, "Interface was disabled"); wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled");
wpa_supplicant_mark_disassoc(wpa_s); wpa_supplicant_mark_disassoc(wpa_s);
wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
break; break;
@ -2081,9 +2088,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
break; break;
case EVENT_BEST_CHANNEL: case EVENT_BEST_CHANNEL:
wpa_printf(MSG_DEBUG, "Best channel event received (%d %d %d)", wpa_dbg(wpa_s, MSG_DEBUG, "Best channel event received "
data->best_chan.freq_24, data->best_chan.freq_5, "(%d %d %d)",
data->best_chan.freq_overall); data->best_chan.freq_24, data->best_chan.freq_5,
data->best_chan.freq_overall);
wpa_s->best_24_freq = data->best_chan.freq_24; wpa_s->best_24_freq = data->best_chan.freq_24;
wpa_s->best_5_freq = data->best_chan.freq_5; wpa_s->best_5_freq = data->best_chan.freq_5;
wpa_s->best_overall_freq = data->best_chan.freq_overall; wpa_s->best_overall_freq = data->best_chan.freq_overall;
@ -2109,7 +2117,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
break; break;
default: default:
wpa_printf(MSG_INFO, "Unknown event %d", event); wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
break; break;
} }
} }

View file

@ -44,8 +44,8 @@ static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
wpas_notify_network_changed(wpa_s); wpas_notify_network_changed(wpa_s);
} }
wpa_supplicant_initiate_eapol(wpa_s); wpa_supplicant_initiate_eapol(wpa_s);
wpa_printf(MSG_DEBUG, "Already associated with a configured network - " wpa_dbg(wpa_s, MSG_DEBUG, "Already associated with a configured "
"generating associated event"); "network - generating associated event");
os_memset(&data, 0, sizeof(data)); os_memset(&data, 0, sizeof(data));
wpa_supplicant_event(wpa_s, EVENT_ASSOC, &data); wpa_supplicant_event(wpa_s, EVENT_ASSOC, &data);
} }
@ -100,8 +100,8 @@ static void wpa_supplicant_assoc_try(struct wpa_supplicant *wpa_s,
/* ap_scan=2 mode - try to associate with each SSID. */ /* ap_scan=2 mode - try to associate with each SSID. */
if (ssid == NULL) { if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "wpa_supplicant_scan: Reached " wpa_dbg(wpa_s, MSG_DEBUG, "wpa_supplicant_assoc_try: Reached "
"end of scan list - go back to beginning"); "end of scan list - go back to beginning");
wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN; wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
wpa_supplicant_req_scan(wpa_s, 0, 0); wpa_supplicant_req_scan(wpa_s, 0, 0);
return; return;
@ -255,7 +255,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
enum wpa_states prev_state; enum wpa_states prev_state;
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
wpa_printf(MSG_DEBUG, "Skip scan - interface disabled"); wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - interface disabled");
return; return;
} }
@ -266,15 +266,15 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
if (!wpa_supplicant_enabled_networks(wpa_s->conf) && if (!wpa_supplicant_enabled_networks(wpa_s->conf) &&
!wpa_s->scan_req) { !wpa_s->scan_req) {
wpa_printf(MSG_DEBUG, "No enabled networks - do not scan"); wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
return; return;
} }
if (wpa_s->conf->ap_scan != 0 && if (wpa_s->conf->ap_scan != 0 &&
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_WIRED)) { (wpa_s->drv_flags & WPA_DRIVER_FLAGS_WIRED)) {
wpa_printf(MSG_DEBUG, "Using wired authentication - " wpa_dbg(wpa_s, MSG_DEBUG, "Using wired authentication - "
"overriding ap_scan configuration"); "overriding ap_scan configuration");
wpa_s->conf->ap_scan = 0; wpa_s->conf->ap_scan = 0;
wpas_notify_ap_scan_changed(wpa_s); wpas_notify_ap_scan_changed(wpa_s);
} }
@ -373,15 +373,17 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
if (ssid) { if (ssid) {
wpa_s->prev_scan_ssid = ssid; wpa_s->prev_scan_ssid = ssid;
if (max_ssids > 1) { if (max_ssids > 1) {
wpa_printf(MSG_DEBUG, "Include wildcard SSID in the " wpa_dbg(wpa_s, MSG_DEBUG, "Include wildcard SSID in "
"scan request"); "the scan request");
params.num_ssids++; params.num_ssids++;
} }
wpa_printf(MSG_DEBUG, "Starting AP scan for specific SSID(s)"); wpa_dbg(wpa_s, MSG_DEBUG, "Starting AP scan for specific "
"SSID(s)");
} else { } else {
wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN; wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
params.num_ssids++; params.num_ssids++;
wpa_printf(MSG_DEBUG, "Starting AP scan for wildcard SSID"); wpa_dbg(wpa_s, MSG_DEBUG, "Starting AP scan for wildcard "
"SSID");
} }
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
@ -396,16 +398,16 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
/* Optimize provisioning state scan based on GO information */ /* Optimize provisioning state scan based on GO information */
if (wpa_s->p2p_in_provisioning < 5 && if (wpa_s->p2p_in_provisioning < 5 &&
wpa_s->go_params->freq > 0) { wpa_s->go_params->freq > 0) {
wpa_printf(MSG_DEBUG, "P2P: Scan only GO preferred " wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO "
"frequency %d MHz", "preferred frequency %d MHz",
wpa_s->go_params->freq); wpa_s->go_params->freq);
params.freqs = os_zalloc(2 * sizeof(int)); params.freqs = os_zalloc(2 * sizeof(int));
if (params.freqs) if (params.freqs)
params.freqs[0] = wpa_s->go_params->freq; params.freqs[0] = wpa_s->go_params->freq;
} else if (wpa_s->p2p_in_provisioning < 8 && } else if (wpa_s->p2p_in_provisioning < 8 &&
wpa_s->go_params->freq_list[0]) { wpa_s->go_params->freq_list[0]) {
wpa_printf(MSG_DEBUG, "P2P: Scan only common " wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only common "
"channels"); "channels");
int_array_concat(&params.freqs, int_array_concat(&params.freqs,
wpa_s->go_params->freq_list); wpa_s->go_params->freq_list);
if (params.freqs) if (params.freqs)
@ -421,8 +423,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
* Optimize post-provisioning scan based on channel used * Optimize post-provisioning scan based on channel used
* during provisioning. * during provisioning.
*/ */
wpa_printf(MSG_DEBUG, "WPS: Scan only frequency %u MHz that " wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz "
"was used during provisioning", wpa_s->wps_freq); "that was used during provisioning", wpa_s->wps_freq);
params.freqs = os_zalloc(2 * sizeof(int)); params.freqs = os_zalloc(2 * sizeof(int));
if (params.freqs) if (params.freqs)
params.freqs[0] = wpa_s->wps_freq; params.freqs[0] = wpa_s->wps_freq;
@ -450,8 +452,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
if (params.freqs == NULL && wpa_s->next_scan_freqs) { if (params.freqs == NULL && wpa_s->next_scan_freqs) {
wpa_printf(MSG_DEBUG, "Optimize scan based on previously " wpa_dbg(wpa_s, MSG_DEBUG, "Optimize scan based on previously "
"generated frequency list"); "generated frequency list");
params.freqs = wpa_s->next_scan_freqs; params.freqs = wpa_s->next_scan_freqs;
} else } else
os_free(wpa_s->next_scan_freqs); os_free(wpa_s->next_scan_freqs);
@ -467,7 +469,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
os_free(params.filter_ssids); os_free(params.filter_ssids);
if (ret) { if (ret) {
wpa_printf(MSG_WARNING, "Failed to initiate AP scan."); wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate AP scan");
if (prev_state != wpa_s->wpa_state) if (prev_state != wpa_s->wpa_state)
wpa_supplicant_set_state(wpa_s, prev_state); wpa_supplicant_set_state(wpa_s, prev_state);
wpa_supplicant_req_scan(wpa_s, 1, 0); wpa_supplicant_req_scan(wpa_s, 1, 0);
@ -502,13 +504,13 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
ssid = ssid->next; ssid = ssid->next;
} }
if (ssid) { if (ssid) {
wpa_msg(wpa_s, MSG_DEBUG, "Not rescheduling scan to " wpa_dbg(wpa_s, MSG_DEBUG, "Not rescheduling scan to "
"ensure that specific SSID scans occur"); "ensure that specific SSID scans occur");
return; return;
} }
} }
wpa_msg(wpa_s, MSG_DEBUG, "Setting scan request: %d sec %d usec", wpa_dbg(wpa_s, MSG_DEBUG, "Setting scan request: %d sec %d usec",
sec, usec); sec, usec);
eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL); eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL);
eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL); eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL);
@ -524,7 +526,7 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
*/ */
void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s) void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s)
{ {
wpa_msg(wpa_s, MSG_DEBUG, "Cancelling scan request"); wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling scan request");
eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL); eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL);
} }
@ -787,14 +789,14 @@ wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
else else
scan_res = wpa_drv_get_scan_results2(wpa_s); scan_res = wpa_drv_get_scan_results2(wpa_s);
if (scan_res == NULL) { if (scan_res == NULL) {
wpa_printf(MSG_DEBUG, "Failed to get scan results"); wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results");
return NULL; return NULL;
} }
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
if (wpas_wps_in_progress(wpa_s)) { if (wpas_wps_in_progress(wpa_s)) {
wpa_printf(MSG_DEBUG, "WPS: Order scan results with WPS " wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Order scan results with WPS "
"provisioning rules"); "provisioning rules");
compar = wpa_scan_result_wps_compar; compar = wpa_scan_result_wps_compar;
} }
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */

View file

@ -48,8 +48,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
int i, bssid_changed; int i, bssid_changed;
if (bss == NULL) { if (bss == NULL) {
wpa_printf(MSG_ERROR, "SME: No scan result available for the " wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for "
"network"); "the network");
return; return;
} }
@ -82,12 +82,12 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
} }
} }
#endif /* IEEE8021X_EAPOL */ #endif /* IEEE8021X_EAPOL */
wpa_printf(MSG_DEBUG, "Automatic auth_alg selection: 0x%x", wpa_dbg(wpa_s, MSG_DEBUG, "Automatic auth_alg selection: 0x%x",
params.auth_alg); params.auth_alg);
if (ssid->auth_alg) { if (ssid->auth_alg) {
params.auth_alg = ssid->auth_alg; params.auth_alg = ssid->auth_alg;
wpa_printf(MSG_DEBUG, "Overriding auth_alg selection: 0x%x", wpa_dbg(wpa_s, MSG_DEBUG, "Overriding auth_alg selection: "
params.auth_alg); "0x%x", params.auth_alg);
} }
for (i = 0; i < NUM_WEP_KEYS; i++) { for (i = 0; i < NUM_WEP_KEYS; i++) {
@ -121,8 +121,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_set_suites(wpa_s, bss, ssid, if (wpa_supplicant_set_suites(wpa_s, bss, ssid,
wpa_s->sme.assoc_req_ie, wpa_s->sme.assoc_req_ie,
&wpa_s->sme.assoc_req_ie_len)) { &wpa_s->sme.assoc_req_ie_len)) {
wpa_printf(MSG_WARNING, "SME: Failed to set WPA key " wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA "
"management and encryption suites"); "key management and encryption suites");
return; return;
} }
} else if (ssid->key_mgmt & } else if (ssid->key_mgmt &
@ -134,9 +134,9 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, if (wpa_supplicant_set_suites(wpa_s, NULL, ssid,
wpa_s->sme.assoc_req_ie, wpa_s->sme.assoc_req_ie,
&wpa_s->sme.assoc_req_ie_len)) { &wpa_s->sme.assoc_req_ie_len)) {
wpa_printf(MSG_WARNING, "SME: Failed to set WPA key " wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA "
"management and encryption suites (no scan " "key management and encryption suites (no "
"results)"); "scan results)");
return; return;
} }
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
@ -187,8 +187,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
if (wpa_s->sme.ft_used && if (wpa_s->sme.ft_used &&
os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 && os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 &&
wpa_sm_has_ptk(wpa_s->wpa)) { wpa_sm_has_ptk(wpa_s->wpa)) {
wpa_printf(MSG_DEBUG, "SME: Trying to use FT " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying to use FT "
"over-the-air"); "over-the-air");
params.auth_alg = WPA_AUTH_ALG_FT; params.auth_alg = WPA_AUTH_ALG_FT;
params.ie = wpa_s->sme.ft_ies; params.ie = wpa_s->sme.ft_ies;
params.ie_len = wpa_s->sme.ft_ies_len; params.ie_len = wpa_s->sme.ft_ies_len;
@ -204,8 +204,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &_ie) == 0 && if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &_ie) == 0 &&
_ie.capabilities & _ie.capabilities &
(WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) { (WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) {
wpa_printf(MSG_DEBUG, "WPA: Selected AP supports MFP: " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected AP supports "
"require MFP"); "MFP: require MFP");
wpa_s->sme.mfp = MGMT_FRAME_PROTECTION_REQUIRED; wpa_s->sme.mfp = MGMT_FRAME_PROTECTION_REQUIRED;
} }
} }
@ -229,7 +229,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
wpa_supplicant_cancel_scan(wpa_s); wpa_supplicant_cancel_scan(wpa_s);
wpa_msg(wpa_s, MSG_INFO, "Trying to authenticate with " MACSTR wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid), " (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),
wpa_ssid_txt(params.ssid, params.ssid_len), params.freq); wpa_ssid_txt(params.ssid, params.ssid_len), params.freq);
@ -244,7 +244,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
wpa_s->sme.auth_alg = params.auth_alg; wpa_s->sme.auth_alg = params.auth_alg;
if (wpa_drv_authenticate(wpa_s, &params) < 0) { if (wpa_drv_authenticate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Authentication request to the " wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
"driver failed"); "driver failed");
wpa_supplicant_req_scan(wpa_s, 1, 0); wpa_supplicant_req_scan(wpa_s, 1, 0);
return; return;
@ -264,34 +264,34 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
struct wpa_ssid *ssid = wpa_s->current_ssid; struct wpa_ssid *ssid = wpa_s->current_ssid;
if (ssid == NULL) { if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "SME: Ignore authentication event when " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "
"network is not selected"); "when network is not selected");
return; return;
} }
if (wpa_s->wpa_state != WPA_AUTHENTICATING) { if (wpa_s->wpa_state != WPA_AUTHENTICATING) {
wpa_printf(MSG_DEBUG, "SME: Ignore authentication event when " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "
"not in authenticating state"); "when not in authenticating state");
return; return;
} }
if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) { if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) {
wpa_printf(MSG_DEBUG, "SME: Ignore authentication with " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication with "
"unexpected peer " MACSTR, "unexpected peer " MACSTR,
MAC2STR(data->auth.peer)); MAC2STR(data->auth.peer));
return; return;
} }
wpa_printf(MSG_DEBUG, "SME: Authentication response: peer=" MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication response: peer=" MACSTR
" auth_type=%d status_code=%d", " auth_type=%d status_code=%d",
MAC2STR(data->auth.peer), data->auth.auth_type, MAC2STR(data->auth.peer), data->auth.auth_type,
data->auth.status_code); data->auth.status_code);
wpa_hexdump(MSG_MSGDUMP, "SME: Authentication response IEs", wpa_hexdump(MSG_MSGDUMP, "SME: Authentication response IEs",
data->auth.ies, data->auth.ies_len); data->auth.ies, data->auth.ies_len);
if (data->auth.status_code != WLAN_STATUS_SUCCESS) { if (data->auth.status_code != WLAN_STATUS_SUCCESS) {
wpa_printf(MSG_DEBUG, "SME: Authentication failed (status " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication failed (status "
"code %d)", data->auth.status_code); "code %d)", data->auth.status_code);
if (data->auth.status_code != if (data->auth.status_code !=
WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG || WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ||
@ -305,7 +305,7 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
case WLAN_AUTH_OPEN: case WLAN_AUTH_OPEN:
wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED; wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED;
wpa_printf(MSG_DEBUG, "SME: Trying SHARED auth"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying SHARED auth");
wpa_supplicant_associate(wpa_s, wpa_s->current_bss, wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
wpa_s->current_ssid); wpa_s->current_ssid);
return; return;
@ -313,7 +313,7 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
case WLAN_AUTH_SHARED_KEY: case WLAN_AUTH_SHARED_KEY:
wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP; wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP;
wpa_printf(MSG_DEBUG, "SME: Trying LEAP auth"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying LEAP auth");
wpa_supplicant_associate(wpa_s, wpa_s->current_bss, wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
wpa_s->current_ssid); wpa_s->current_ssid);
return; return;
@ -376,7 +376,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
if (params.wpa_ie == NULL || if (params.wpa_ie == NULL ||
ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0) ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0)
< 0) { < 0) {
wpa_printf(MSG_DEBUG, "SME: Could not parse own IEs?!"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Could not parse own IEs?!");
os_memset(&elems, 0, sizeof(elems)); os_memset(&elems, 0, sizeof(elems));
} }
if (elems.rsn_ie) if (elems.rsn_ie)
@ -397,8 +397,8 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
params.uapsd = -1; params.uapsd = -1;
if (wpa_drv_associate(wpa_s, &params) < 0) { if (wpa_drv_associate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Association request to the driver " wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
"failed"); "driver failed");
wpas_connection_failed(wpa_s, wpa_s->pending_bssid); wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
return; return;
@ -412,7 +412,7 @@ int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md,
const u8 *ies, size_t ies_len) const u8 *ies, size_t ies_len)
{ {
if (md == NULL || ies == NULL) { if (md == NULL || ies == NULL) {
wpa_printf(MSG_DEBUG, "SME: Remove mobility domain"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Remove mobility domain");
os_free(wpa_s->sme.ft_ies); os_free(wpa_s->sme.ft_ies);
wpa_s->sme.ft_ies = NULL; wpa_s->sme.ft_ies = NULL;
wpa_s->sme.ft_ies_len = 0; wpa_s->sme.ft_ies_len = 0;
@ -437,9 +437,9 @@ void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
{ {
int bssid_changed; int bssid_changed;
wpa_printf(MSG_DEBUG, "SME: Association with " MACSTR " failed: " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association with " MACSTR " failed: "
"status code %d", MAC2STR(wpa_s->pending_bssid), "status code %d", MAC2STR(wpa_s->pending_bssid),
data->assoc_reject.status_code); data->assoc_reject.status_code);
bssid_changed = !is_zero_ether_addr(wpa_s->bssid); bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
@ -452,8 +452,8 @@ void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
*/ */
if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid,
WLAN_REASON_DEAUTH_LEAVING) < 0) { WLAN_REASON_DEAUTH_LEAVING) < 0) {
wpa_msg(wpa_s, MSG_INFO, wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver "
"Deauth request to the driver failed"); "failed");
} }
wpa_s->sme.prev_bssid_set = 0; wpa_s->sme.prev_bssid_set = 0;
@ -469,7 +469,7 @@ void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,
void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s, void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
union wpa_event_data *data) union wpa_event_data *data)
{ {
wpa_printf(MSG_DEBUG, "SME: Authentication timed out"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out");
wpas_connection_failed(wpa_s, wpa_s->pending_bssid); wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
} }
@ -477,7 +477,7 @@ void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,
union wpa_event_data *data) union wpa_event_data *data)
{ {
wpa_printf(MSG_DEBUG, "SME: Association timed out"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out");
wpas_connection_failed(wpa_s, wpa_s->pending_bssid); wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
wpa_supplicant_mark_disassoc(wpa_s); wpa_supplicant_mark_disassoc(wpa_s);
} }
@ -486,7 +486,7 @@ void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,
void sme_event_disassoc(struct wpa_supplicant *wpa_s, void sme_event_disassoc(struct wpa_supplicant *wpa_s,
union wpa_event_data *data) union wpa_event_data *data)
{ {
wpa_printf(MSG_DEBUG, "SME: Disassociation event received"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: Disassociation event received");
if (wpa_s->sme.prev_bssid_set && if (wpa_s->sme.prev_bssid_set &&
!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)) { !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)) {
/* /*
@ -495,8 +495,8 @@ void sme_event_disassoc(struct wpa_supplicant *wpa_s,
* state. For now, force the state to be cleared to avoid * state. For now, force the state to be cleared to avoid
* confusing errors if we try to associate with the AP again. * confusing errors if we try to associate with the AP again.
*/ */
wpa_printf(MSG_DEBUG, "SME: Deauthenticate to clear driver " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Deauthenticate to clear "
"state"); "driver state");
wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid, wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid,
WLAN_REASON_DEAUTH_LEAVING); WLAN_REASON_DEAUTH_LEAVING);
} }
@ -516,7 +516,7 @@ static int sme_check_sa_query_timeout(struct wpa_supplicant *wpa_s)
os_time_sub(&now, &wpa_s->sme.sa_query_start, &passed); os_time_sub(&now, &wpa_s->sme.sa_query_start, &passed);
tu = (passed.sec * 1000000 + passed.usec) / 1024; tu = (passed.sec * 1000000 + passed.usec) / 1024;
if (sa_query_max_timeout < tu) { if (sa_query_max_timeout < tu) {
wpa_printf(MSG_DEBUG, "SME: SA Query timed out"); wpa_dbg(wpa_s, MSG_DEBUG, "SME: SA Query timed out");
sme_stop_sa_query(wpa_s); sme_stop_sa_query(wpa_s);
wpa_supplicant_deauthenticate( wpa_supplicant_deauthenticate(
wpa_s, WLAN_REASON_PREV_AUTH_NOT_VALID); wpa_s, WLAN_REASON_PREV_AUTH_NOT_VALID);
@ -531,8 +531,8 @@ static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s,
const u8 *trans_id) const u8 *trans_id)
{ {
u8 req[2 + WLAN_SA_QUERY_TR_ID_LEN]; u8 req[2 + WLAN_SA_QUERY_TR_ID_LEN];
wpa_printf(MSG_DEBUG, "SME: Sending SA Query Request to " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Request to "
MACSTR, MAC2STR(wpa_s->bssid)); MACSTR, MAC2STR(wpa_s->bssid));
wpa_hexdump(MSG_DEBUG, "SME: SA Query Transaction ID", wpa_hexdump(MSG_DEBUG, "SME: SA Query Transaction ID",
trans_id, WLAN_SA_QUERY_TR_ID_LEN); trans_id, WLAN_SA_QUERY_TR_ID_LEN);
req[0] = WLAN_ACTION_SA_QUERY; req[0] = WLAN_ACTION_SA_QUERY;
@ -541,7 +541,8 @@ static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s,
if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
wpa_s->own_addr, wpa_s->bssid, wpa_s->own_addr, wpa_s->bssid,
req, sizeof(req)) < 0) req, sizeof(req)) < 0)
wpa_printf(MSG_INFO, "SME: Failed to send SA Query Request"); wpa_msg(wpa_s, MSG_INFO, "SME: Failed to send SA Query "
"Request");
} }
@ -575,8 +576,8 @@ static void sme_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
usec = (timeout % 1000) * 1024; usec = (timeout % 1000) * 1024;
eloop_register_timeout(sec, usec, sme_sa_query_timer, wpa_s, NULL); eloop_register_timeout(sec, usec, sme_sa_query_timer, wpa_s, NULL);
wpa_printf(MSG_DEBUG, "SME: Association SA Query attempt %d", wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association SA Query attempt %d",
wpa_s->sme.sa_query_count); wpa_s->sme.sa_query_count);
sme_send_sa_query_req(wpa_s, trans_id); sme_send_sa_query_req(wpa_s, trans_id);
} }
@ -617,8 +618,8 @@ void sme_event_unprot_disconnect(struct wpa_supplicant *wpa_s, const u8 *sa,
if (wpa_s->sme.sa_query_count > 0) if (wpa_s->sme.sa_query_count > 0)
return; return;
wpa_printf(MSG_DEBUG, "SME: Unprotected disconnect dropped - possible " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Unprotected disconnect dropped - "
"AP/STA state mismatch - trigger SA Query"); "possible AP/STA state mismatch - trigger SA Query");
sme_start_sa_query(wpa_s); sme_start_sa_query(wpa_s);
} }
@ -632,9 +633,8 @@ void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa,
len < 1 + WLAN_SA_QUERY_TR_ID_LEN || len < 1 + WLAN_SA_QUERY_TR_ID_LEN ||
data[0] != WLAN_SA_QUERY_RESPONSE) data[0] != WLAN_SA_QUERY_RESPONSE)
return; return;
wpa_printf(MSG_DEBUG, "SME: Received SA Query response from " MACSTR wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query response from "
" (trans_id %02x%02x)", MACSTR " (trans_id %02x%02x)", MAC2STR(sa), data[1], data[2]);
MAC2STR(sa), data[1], data[2]);
if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0) if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0)
return; return;
@ -647,13 +647,13 @@ void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa,
} }
if (i >= wpa_s->sme.sa_query_count) { if (i >= wpa_s->sme.sa_query_count) {
wpa_printf(MSG_DEBUG, "SME: No matching SA Query " wpa_dbg(wpa_s, MSG_DEBUG, "SME: No matching SA Query "
"transaction identifier found"); "transaction identifier found");
return; return;
} }
wpa_printf(MSG_DEBUG, "SME: Reply to pending SA Query received from " wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reply to pending SA Query received "
MACSTR, MAC2STR(sa)); "from " MACSTR, MAC2STR(sa));
sme_stop_sa_query(wpa_s); sme_stop_sa_query(wpa_s);
} }

View file

@ -153,13 +153,14 @@ static int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
* sending unicast and multicast packets. */ * sending unicast and multicast packets. */
if (ssid->mode != WPAS_MODE_IBSS) { if (ssid->mode != WPAS_MODE_IBSS) {
wpa_printf(MSG_INFO, "WPA: Invalid mode %d (not IBSS/ad-hoc) " wpa_msg(wpa_s, MSG_INFO, "WPA: Invalid mode %d (not "
"for WPA-None", ssid->mode); "IBSS/ad-hoc) for WPA-None", ssid->mode);
return -1; return -1;
} }
if (!ssid->psk_set) { if (!ssid->psk_set) {
wpa_printf(MSG_INFO, "WPA: No PSK configured for WPA-None"); wpa_msg(wpa_s, MSG_INFO, "WPA: No PSK configured for "
"WPA-None");
return -1; return -1;
} }
@ -177,8 +178,8 @@ static int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
alg = WPA_ALG_TKIP; alg = WPA_ALG_TKIP;
break; break;
default: default:
wpa_printf(MSG_INFO, "WPA: Invalid group cipher %d for " wpa_msg(wpa_s, MSG_INFO, "WPA: Invalid group cipher %d for "
"WPA-None", wpa_s->group_cipher); "WPA-None", wpa_s->group_cipher);
return -1; return -1;
} }
@ -221,7 +222,7 @@ void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_WIRED)) (wpa_s->drv_flags & WPA_DRIVER_FLAGS_WIRED))
return; return;
wpa_msg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec " wpa_dbg(wpa_s, MSG_DEBUG, "Setting authentication timeout: %d sec "
"%d usec", sec, usec); "%d usec", sec, usec);
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL); eloop_register_timeout(sec, usec, wpa_supplicant_timeout, wpa_s, NULL);
@ -238,7 +239,7 @@ void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
*/ */
void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s) void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s)
{ {
wpa_msg(wpa_s, MSG_DEBUG, "Cancelling authentication timeout"); wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling authentication timeout");
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL); eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
wpa_blacklist_del(wpa_s, wpa_s->bssid); wpa_blacklist_del(wpa_s, wpa_s->bssid);
} }
@ -458,8 +459,8 @@ void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr)
* client not receiving the first encrypted packets correctly. * client not receiving the first encrypted packets correctly.
* Skipping some of the extra key clearing steps seems to help * Skipping some of the extra key clearing steps seems to help
* in completing group key handshake more reliably. */ * in completing group key handshake more reliably. */
wpa_printf(MSG_DEBUG, "No keys have been configured - " wpa_dbg(wpa_s, MSG_DEBUG, "No keys have been configured - "
"skip key clearing"); "skip key clearing");
return; return;
} }
@ -532,9 +533,9 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
{ {
enum wpa_states old_state = wpa_s->wpa_state; enum wpa_states old_state = wpa_s->wpa_state;
wpa_printf(MSG_DEBUG, "%s: State: %s -> %s", wpa_dbg(wpa_s, MSG_DEBUG, "State: %s -> %s",
wpa_s->ifname, wpa_supplicant_state_txt(wpa_s->wpa_state), wpa_supplicant_state_txt(wpa_s->wpa_state),
wpa_supplicant_state_txt(state)); wpa_supplicant_state_txt(state));
if (state != WPA_SCANNING) if (state != WPA_SCANNING)
wpa_supplicant_notify_scanning(wpa_s, 0); wpa_supplicant_notify_scanning(wpa_s, 0);
@ -695,7 +696,7 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
wpa_s->reassociate = 1; wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0); wpa_supplicant_req_scan(wpa_s, 0, 0);
} }
wpa_msg(wpa_s, MSG_DEBUG, "Reconfiguration completed"); wpa_dbg(wpa_s, MSG_DEBUG, "Reconfiguration completed");
return 0; return 0;
} }
@ -704,8 +705,9 @@ static void wpa_supplicant_reconfig(int sig, void *signal_ctx)
{ {
struct wpa_global *global = signal_ctx; struct wpa_global *global = signal_ctx;
struct wpa_supplicant *wpa_s; struct wpa_supplicant *wpa_s;
wpa_printf(MSG_DEBUG, "Signal %d received - reconfiguring", sig);
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
wpa_dbg(wpa_s, MSG_DEBUG, "Signal %d received - reconfiguring",
sig);
if (wpa_supplicant_reload_configuration(wpa_s) < 0) { if (wpa_supplicant_reload_configuration(wpa_s) < 0) {
wpa_supplicant_terminate_proc(global); wpa_supplicant_terminate_proc(global);
} }
@ -772,8 +774,8 @@ static int wpa_supplicant_suites_from_ai(struct wpa_supplicant *wpa_s,
return -1; return -1;
} }
wpa_printf(MSG_DEBUG, "WPA: Using WPA IE from AssocReq to set cipher " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Using WPA IE from AssocReq to set "
"suites"); "cipher suites");
if (!(ie->group_cipher & ssid->group_cipher)) { if (!(ie->group_cipher & ssid->group_cipher)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: Driver used disabled group " wpa_msg(wpa_s, MSG_INFO, "WPA: Driver used disabled group "
"cipher 0x%x (mask 0x%x) - reject", "cipher 0x%x (mask 0x%x) - reject",
@ -840,14 +842,14 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
(ie.group_cipher & ssid->group_cipher) && (ie.group_cipher & ssid->group_cipher) &&
(ie.pairwise_cipher & ssid->pairwise_cipher) && (ie.pairwise_cipher & ssid->pairwise_cipher) &&
(ie.key_mgmt & ssid->key_mgmt)) { (ie.key_mgmt & ssid->key_mgmt)) {
wpa_msg(wpa_s, MSG_DEBUG, "RSN: using IEEE 802.11i/D9.0"); wpa_dbg(wpa_s, MSG_DEBUG, "RSN: using IEEE 802.11i/D9.0");
proto = WPA_PROTO_RSN; proto = WPA_PROTO_RSN;
} else if (bss_wpa && (ssid->proto & WPA_PROTO_WPA) && } else if (bss_wpa && (ssid->proto & WPA_PROTO_WPA) &&
wpa_parse_wpa_ie(bss_wpa, 2 +bss_wpa[1], &ie) == 0 && wpa_parse_wpa_ie(bss_wpa, 2 +bss_wpa[1], &ie) == 0 &&
(ie.group_cipher & ssid->group_cipher) && (ie.group_cipher & ssid->group_cipher) &&
(ie.pairwise_cipher & ssid->pairwise_cipher) && (ie.pairwise_cipher & ssid->pairwise_cipher) &&
(ie.key_mgmt & ssid->key_mgmt)) { (ie.key_mgmt & ssid->key_mgmt)) {
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using IEEE 802.11i/D3.0"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using IEEE 802.11i/D3.0");
proto = WPA_PROTO_WPA; proto = WPA_PROTO_WPA;
} else if (bss) { } else if (bss) {
wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select WPA/RSN"); wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select WPA/RSN");
@ -867,19 +869,19 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
ssid->ieee80211w != NO_MGMT_FRAME_PROTECTION ? ssid->ieee80211w != NO_MGMT_FRAME_PROTECTION ?
WPA_CIPHER_AES_128_CMAC : 0; WPA_CIPHER_AES_128_CMAC : 0;
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
wpa_printf(MSG_DEBUG, "WPA: Set cipher suites based " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Set cipher suites "
"on configuration"); "based on configuration");
} else } else
proto = ie.proto; proto = ie.proto;
} }
wpa_printf(MSG_DEBUG, "WPA: Selected cipher suites: group %d " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Selected cipher suites: group %d "
"pairwise %d key_mgmt %d proto %d", "pairwise %d key_mgmt %d proto %d",
ie.group_cipher, ie.pairwise_cipher, ie.key_mgmt, proto); ie.group_cipher, ie.pairwise_cipher, ie.key_mgmt, proto);
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
if (ssid->ieee80211w) { if (ssid->ieee80211w) {
wpa_printf(MSG_DEBUG, "WPA: Selected mgmt group cipher %d", wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Selected mgmt group cipher %d",
ie.mgmt_group_cipher); ie.mgmt_group_cipher);
} }
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
@ -898,34 +900,35 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
sel = ie.group_cipher & ssid->group_cipher; sel = ie.group_cipher & ssid->group_cipher;
if (sel & WPA_CIPHER_CCMP) { if (sel & WPA_CIPHER_CCMP) {
wpa_s->group_cipher = WPA_CIPHER_CCMP; wpa_s->group_cipher = WPA_CIPHER_CCMP;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using GTK CCMP"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using GTK CCMP");
} else if (sel & WPA_CIPHER_TKIP) { } else if (sel & WPA_CIPHER_TKIP) {
wpa_s->group_cipher = WPA_CIPHER_TKIP; wpa_s->group_cipher = WPA_CIPHER_TKIP;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using GTK TKIP"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using GTK TKIP");
} else if (sel & WPA_CIPHER_WEP104) { } else if (sel & WPA_CIPHER_WEP104) {
wpa_s->group_cipher = WPA_CIPHER_WEP104; wpa_s->group_cipher = WPA_CIPHER_WEP104;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using GTK WEP104"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using GTK WEP104");
} else if (sel & WPA_CIPHER_WEP40) { } else if (sel & WPA_CIPHER_WEP40) {
wpa_s->group_cipher = WPA_CIPHER_WEP40; wpa_s->group_cipher = WPA_CIPHER_WEP40;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using GTK WEP40"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using GTK WEP40");
} else { } else {
wpa_printf(MSG_WARNING, "WPA: Failed to select group cipher."); wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select group "
"cipher");
return -1; return -1;
} }
sel = ie.pairwise_cipher & ssid->pairwise_cipher; sel = ie.pairwise_cipher & ssid->pairwise_cipher;
if (sel & WPA_CIPHER_CCMP) { if (sel & WPA_CIPHER_CCMP) {
wpa_s->pairwise_cipher = WPA_CIPHER_CCMP; wpa_s->pairwise_cipher = WPA_CIPHER_CCMP;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using PTK CCMP"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using PTK CCMP");
} else if (sel & WPA_CIPHER_TKIP) { } else if (sel & WPA_CIPHER_TKIP) {
wpa_s->pairwise_cipher = WPA_CIPHER_TKIP; wpa_s->pairwise_cipher = WPA_CIPHER_TKIP;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using PTK TKIP"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using PTK TKIP");
} else if (sel & WPA_CIPHER_NONE) { } else if (sel & WPA_CIPHER_NONE) {
wpa_s->pairwise_cipher = WPA_CIPHER_NONE; wpa_s->pairwise_cipher = WPA_CIPHER_NONE;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using PTK NONE"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using PTK NONE");
} else { } else {
wpa_printf(MSG_WARNING, "WPA: Failed to select pairwise " wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select pairwise "
"cipher."); "cipher");
return -1; return -1;
} }
@ -934,33 +937,33 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
} else if (sel & WPA_KEY_MGMT_FT_IEEE8021X) { } else if (sel & WPA_KEY_MGMT_FT_IEEE8021X) {
wpa_s->key_mgmt = WPA_KEY_MGMT_FT_IEEE8021X; wpa_s->key_mgmt = WPA_KEY_MGMT_FT_IEEE8021X;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT FT/802.1X"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT FT/802.1X");
} else if (sel & WPA_KEY_MGMT_FT_PSK) { } else if (sel & WPA_KEY_MGMT_FT_PSK) {
wpa_s->key_mgmt = WPA_KEY_MGMT_FT_PSK; wpa_s->key_mgmt = WPA_KEY_MGMT_FT_PSK;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT FT/PSK"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT FT/PSK");
#endif /* CONFIG_IEEE80211R */ #endif /* CONFIG_IEEE80211R */
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
} else if (sel & WPA_KEY_MGMT_IEEE8021X_SHA256) { } else if (sel & WPA_KEY_MGMT_IEEE8021X_SHA256) {
wpa_s->key_mgmt = WPA_KEY_MGMT_IEEE8021X_SHA256; wpa_s->key_mgmt = WPA_KEY_MGMT_IEEE8021X_SHA256;
wpa_msg(wpa_s, MSG_DEBUG, wpa_dbg(wpa_s, MSG_DEBUG,
"WPA: using KEY_MGMT 802.1X with SHA256"); "WPA: using KEY_MGMT 802.1X with SHA256");
} else if (sel & WPA_KEY_MGMT_PSK_SHA256) { } else if (sel & WPA_KEY_MGMT_PSK_SHA256) {
wpa_s->key_mgmt = WPA_KEY_MGMT_PSK_SHA256; wpa_s->key_mgmt = WPA_KEY_MGMT_PSK_SHA256;
wpa_msg(wpa_s, MSG_DEBUG, wpa_dbg(wpa_s, MSG_DEBUG,
"WPA: using KEY_MGMT PSK with SHA256"); "WPA: using KEY_MGMT PSK with SHA256");
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
} else if (sel & WPA_KEY_MGMT_IEEE8021X) { } else if (sel & WPA_KEY_MGMT_IEEE8021X) {
wpa_s->key_mgmt = WPA_KEY_MGMT_IEEE8021X; wpa_s->key_mgmt = WPA_KEY_MGMT_IEEE8021X;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT 802.1X"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT 802.1X");
} else if (sel & WPA_KEY_MGMT_PSK) { } else if (sel & WPA_KEY_MGMT_PSK) {
wpa_s->key_mgmt = WPA_KEY_MGMT_PSK; wpa_s->key_mgmt = WPA_KEY_MGMT_PSK;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT WPA-PSK"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT WPA-PSK");
} else if (sel & WPA_KEY_MGMT_WPA_NONE) { } else if (sel & WPA_KEY_MGMT_WPA_NONE) {
wpa_s->key_mgmt = WPA_KEY_MGMT_WPA_NONE; wpa_s->key_mgmt = WPA_KEY_MGMT_WPA_NONE;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT WPA-NONE"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT WPA-NONE");
} else { } else {
wpa_printf(MSG_WARNING, "WPA: Failed to select authenticated " wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select "
"key management type."); "authenticated key management type");
return -1; return -1;
} }
@ -976,11 +979,11 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
sel = 0; sel = 0;
if (sel & WPA_CIPHER_AES_128_CMAC) { if (sel & WPA_CIPHER_AES_128_CMAC) {
wpa_s->mgmt_group_cipher = WPA_CIPHER_AES_128_CMAC; wpa_s->mgmt_group_cipher = WPA_CIPHER_AES_128_CMAC;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: using MGMT group cipher " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using MGMT group cipher "
"AES-128-CMAC"); "AES-128-CMAC");
} else { } else {
wpa_s->mgmt_group_cipher = 0; wpa_s->mgmt_group_cipher = 0;
wpa_msg(wpa_s, MSG_DEBUG, "WPA: not using MGMT group cipher"); wpa_dbg(wpa_s, MSG_DEBUG, "WPA: not using MGMT group cipher");
} }
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_MGMT_GROUP, wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_MGMT_GROUP,
wpa_s->mgmt_group_cipher); wpa_s->mgmt_group_cipher);
@ -988,7 +991,7 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
if (wpa_sm_set_assoc_wpa_ie_default(wpa_s->wpa, wpa_ie, wpa_ie_len)) { if (wpa_sm_set_assoc_wpa_ie_default(wpa_s->wpa, wpa_ie, wpa_ie_len)) {
wpa_printf(MSG_WARNING, "WPA: Failed to generate WPA IE."); wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to generate WPA IE");
return -1; return -1;
} }
@ -1028,15 +1031,15 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION) { ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION) {
#ifdef CONFIG_AP #ifdef CONFIG_AP
if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_AP)) { if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_AP)) {
wpa_printf(MSG_INFO, "Driver does not support AP " wpa_msg(wpa_s, MSG_INFO, "Driver does not support AP "
"mode"); "mode");
return; return;
} }
wpa_supplicant_create_ap(wpa_s, ssid); wpa_supplicant_create_ap(wpa_s, ssid);
wpa_s->current_bss = bss; wpa_s->current_bss = bss;
#else /* CONFIG_AP */ #else /* CONFIG_AP */
wpa_printf(MSG_ERROR, "AP mode support not included in the " wpa_msg(wpa_s, MSG_ERROR, "AP mode support not included in "
"build"); "the build");
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
return; return;
} }
@ -1103,11 +1106,11 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
} }
} }
#endif /* IEEE8021X_EAPOL */ #endif /* IEEE8021X_EAPOL */
wpa_printf(MSG_DEBUG, "Automatic auth_alg selection: 0x%x", algs); wpa_dbg(wpa_s, MSG_DEBUG, "Automatic auth_alg selection: 0x%x", algs);
if (ssid->auth_alg) { if (ssid->auth_alg) {
algs = ssid->auth_alg; algs = ssid->auth_alg;
wpa_printf(MSG_DEBUG, "Overriding auth_alg selection: 0x%x", wpa_dbg(wpa_s, MSG_DEBUG, "Overriding auth_alg selection: "
algs); "0x%x", algs);
} }
if (bss && (wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) || if (bss && (wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
@ -1127,8 +1130,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_ie_len = sizeof(wpa_ie); wpa_ie_len = sizeof(wpa_ie);
if (wpa_supplicant_set_suites(wpa_s, bss, ssid, if (wpa_supplicant_set_suites(wpa_s, bss, ssid,
wpa_ie, &wpa_ie_len)) { wpa_ie, &wpa_ie_len)) {
wpa_printf(MSG_WARNING, "WPA: Failed to set WPA key " wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to set WPA "
"management and encryption suites"); "key management and encryption suites");
return; return;
} }
} else if (ssid->key_mgmt & } else if (ssid->key_mgmt &
@ -1139,9 +1142,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_ie_len = sizeof(wpa_ie); wpa_ie_len = sizeof(wpa_ie);
if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, if (wpa_supplicant_set_suites(wpa_s, NULL, ssid,
wpa_ie, &wpa_ie_len)) { wpa_ie, &wpa_ie_len)) {
wpa_printf(MSG_WARNING, "WPA: Failed to set WPA key " wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to set WPA "
"management and encryption suites (no scan " "key management and encryption suites (no "
"results)"); "scan results)");
return; return;
} }
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
@ -1187,10 +1190,10 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_s->cross_connect_disallowed = wpa_s->cross_connect_disallowed =
p2p_get_cross_connect_disallowed(p2p); p2p_get_cross_connect_disallowed(p2p);
wpabuf_free(p2p); wpabuf_free(p2p);
wpa_printf(MSG_DEBUG, "P2P: WLAN AP %s cross " wpa_dbg(wpa_s, MSG_DEBUG, "P2P: WLAN AP %s cross "
"connection", "connection",
wpa_s->cross_connect_disallowed ? wpa_s->cross_connect_disallowed ?
"disallows" : "allows"); "disallows" : "allows");
} }
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
@ -1277,8 +1280,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ie) == 0 && if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ie) == 0 &&
ie.capabilities & ie.capabilities &
(WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) { (WPA_CAPABILITY_MFPC | WPA_CAPABILITY_MFPR)) {
wpa_printf(MSG_DEBUG, "WPA: Selected AP supports MFP: " wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Selected AP supports "
"require MFP"); "MFP: require MFP");
params.mgmt_frame_protection = params.mgmt_frame_protection =
MGMT_FRAME_PROTECTION_REQUIRED; MGMT_FRAME_PROTECTION_REQUIRED;
} }
@ -1662,15 +1665,15 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) { if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) {
if (ieee80211_sta_get_ssid(wpa_s, ssid, &ssid_len)) { if (ieee80211_sta_get_ssid(wpa_s, ssid, &ssid_len)) {
wpa_printf(MSG_WARNING, "Could not read SSID from " wpa_msg(wpa_s, MSG_WARNING, "Could not read SSID from "
"MLME."); "MLME");
return NULL; return NULL;
} }
} else { } else {
res = wpa_drv_get_ssid(wpa_s, ssid); res = wpa_drv_get_ssid(wpa_s, ssid);
if (res < 0) { if (res < 0) {
wpa_printf(MSG_WARNING, "Could not read SSID from " wpa_msg(wpa_s, MSG_WARNING, "Could not read SSID from "
"driver."); "driver");
return NULL; return NULL;
} }
ssid_len = res; ssid_len = res;
@ -1679,7 +1682,8 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
os_memcpy(bssid, wpa_s->bssid, ETH_ALEN); os_memcpy(bssid, wpa_s->bssid, ETH_ALEN);
else if (wpa_drv_get_bssid(wpa_s, bssid) < 0) { else if (wpa_drv_get_bssid(wpa_s, bssid) < 0) {
wpa_printf(MSG_WARNING, "Could not read BSSID from driver."); wpa_msg(wpa_s, MSG_WARNING, "Could not read BSSID from "
"driver");
return NULL; return NULL;
} }
@ -1720,8 +1724,8 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
return -1; return -1;
if (wpa_drivers[0] == NULL) { if (wpa_drivers[0] == NULL) {
wpa_printf(MSG_ERROR, "No driver interfaces build into " wpa_msg(wpa_s, MSG_ERROR, "No driver interfaces build into "
"wpa_supplicant."); "wpa_supplicant");
return -1; return -1;
} }
@ -1753,7 +1757,7 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
driver = pos + 1; driver = pos + 1;
} while (pos); } while (pos);
wpa_printf(MSG_ERROR, "Unsupported driver '%s'.", name); wpa_msg(wpa_s, MSG_ERROR, "Unsupported driver '%s'", name);
return -1; return -1;
} }
@ -1777,7 +1781,7 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;
wpa_printf(MSG_DEBUG, "RX EAPOL from " MACSTR, MAC2STR(src_addr)); wpa_dbg(wpa_s, MSG_DEBUG, "RX EAPOL from " MACSTR, MAC2STR(src_addr));
wpa_hexdump(MSG_MSGDUMP, "RX EAPOL", buf, len); wpa_hexdump(MSG_MSGDUMP, "RX EAPOL", buf, len);
if (wpa_s->wpa_state < WPA_ASSOCIATED) { if (wpa_s->wpa_state < WPA_ASSOCIATED) {
@ -1789,8 +1793,8 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
* association information, lets queue it for processing until * association information, lets queue it for processing until
* the association event is received. * the association event is received.
*/ */
wpa_printf(MSG_DEBUG, "Not associated - Delay processing of " wpa_dbg(wpa_s, MSG_DEBUG, "Not associated - Delay processing "
"received EAPOL frame"); "of received EAPOL frame");
wpabuf_free(wpa_s->pending_eapol_rx); wpabuf_free(wpa_s->pending_eapol_rx);
wpa_s->pending_eapol_rx = wpabuf_alloc_copy(buf, len); wpa_s->pending_eapol_rx = wpabuf_alloc_copy(buf, len);
if (wpa_s->pending_eapol_rx) { if (wpa_s->pending_eapol_rx) {
@ -1809,8 +1813,8 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
#endif /* CONFIG_AP */ #endif /* CONFIG_AP */
if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE) { if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE) {
wpa_printf(MSG_DEBUG, "Ignored received EAPOL frame since " wpa_dbg(wpa_s, MSG_DEBUG, "Ignored received EAPOL frame since "
"no key management is configured"); "no key management is configured");
return; return;
} }
@ -1831,8 +1835,8 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
wpa_s->eapol_received++; wpa_s->eapol_received++;
if (wpa_s->countermeasures) { if (wpa_s->countermeasures) {
wpa_printf(MSG_INFO, "WPA: Countermeasures - dropped EAPOL " wpa_msg(wpa_s, MSG_INFO, "WPA: Countermeasures - dropped "
"packet"); "EAPOL packet");
return; return;
} }
@ -1901,25 +1905,25 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
} }
if (wpa_s->l2 && l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) { if (wpa_s->l2 && l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) {
wpa_printf(MSG_ERROR, "Failed to get own L2 address"); wpa_msg(wpa_s, MSG_ERROR, "Failed to get own L2 address");
return -1; return -1;
} }
wpa_printf(MSG_DEBUG, "Own MAC address: " MACSTR, wpa_dbg(wpa_s, MSG_DEBUG, "Own MAC address: " MACSTR,
MAC2STR(wpa_s->own_addr)); MAC2STR(wpa_s->own_addr));
if (wpa_s->bridge_ifname[0]) { if (wpa_s->bridge_ifname[0]) {
wpa_printf(MSG_DEBUG, "Receiving packets from bridge interface" wpa_dbg(wpa_s, MSG_DEBUG, "Receiving packets from bridge "
" '%s'", wpa_s->bridge_ifname); "interface '%s'", wpa_s->bridge_ifname);
wpa_s->l2_br = l2_packet_init(wpa_s->bridge_ifname, wpa_s->l2_br = l2_packet_init(wpa_s->bridge_ifname,
wpa_s->own_addr, wpa_s->own_addr,
ETH_P_EAPOL, ETH_P_EAPOL,
wpa_supplicant_rx_eapol, wpa_s, wpa_supplicant_rx_eapol, wpa_s,
0); 0);
if (wpa_s->l2_br == NULL) { if (wpa_s->l2_br == NULL) {
wpa_printf(MSG_ERROR, "Failed to open l2_packet " wpa_msg(wpa_s, MSG_ERROR, "Failed to open l2_packet "
"connection for the bridge interface '%s'", "connection for the bridge interface '%s'",
wpa_s->bridge_ifname); wpa_s->bridge_ifname);
return -1; return -1;
} }
} }
@ -1930,7 +1934,7 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
* happen if wpa_supplicant is killed during countermeasures. */ * happen if wpa_supplicant is killed during countermeasures. */
wpa_drv_set_countermeasures(wpa_s, 0); wpa_drv_set_countermeasures(wpa_s, 0);
wpa_printf(MSG_DEBUG, "RSN: flushing PMKID list in the driver"); wpa_dbg(wpa_s, MSG_DEBUG, "RSN: flushing PMKID list in the driver");
wpa_drv_flush_pmkid(wpa_s); wpa_drv_flush_pmkid(wpa_s);
wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN; wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
@ -2064,24 +2068,25 @@ next_driver:
const char *pos; const char *pos;
pos = driver ? os_strchr(driver, ',') : NULL; pos = driver ? os_strchr(driver, ',') : NULL;
if (pos) { if (pos) {
wpa_printf(MSG_DEBUG, "Failed to initialize driver " wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize "
"interface - try next driver wrapper"); "driver interface - try next driver wrapper");
driver = pos + 1; driver = pos + 1;
goto next_driver; goto next_driver;
} }
wpa_printf(MSG_ERROR, "Failed to initialize driver interface"); wpa_msg(wpa_s, MSG_ERROR, "Failed to initialize driver "
"interface");
return -1; return -1;
} }
if (wpa_drv_set_param(wpa_s, wpa_s->conf->driver_param) < 0) { if (wpa_drv_set_param(wpa_s, wpa_s->conf->driver_param) < 0) {
wpa_printf(MSG_ERROR, "Driver interface rejected " wpa_msg(wpa_s, MSG_ERROR, "Driver interface rejected "
"driver_param '%s'", wpa_s->conf->driver_param); "driver_param '%s'", wpa_s->conf->driver_param);
return -1; return -1;
} }
ifname = wpa_drv_get_ifname(wpa_s); ifname = wpa_drv_get_ifname(wpa_s);
if (ifname && os_strcmp(ifname, wpa_s->ifname) != 0) { if (ifname && os_strcmp(ifname, wpa_s->ifname) != 0) {
wpa_printf(MSG_DEBUG, "Driver interface replaced interface " wpa_dbg(wpa_s, MSG_DEBUG, "Driver interface replaced "
"name with '%s'", ifname); "interface name with '%s'", ifname);
os_strlcpy(wpa_s->ifname, ifname, sizeof(wpa_s->ifname)); os_strlcpy(wpa_s->ifname, ifname, sizeof(wpa_s->ifname));
} }
@ -2096,15 +2101,15 @@ next_driver:
if (wpa_s->conf->dot11RSNAConfigPMKLifetime && if (wpa_s->conf->dot11RSNAConfigPMKLifetime &&
wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME, wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,
wpa_s->conf->dot11RSNAConfigPMKLifetime)) { wpa_s->conf->dot11RSNAConfigPMKLifetime)) {
wpa_printf(MSG_ERROR, "Invalid WPA parameter value for " wpa_msg(wpa_s, MSG_ERROR, "Invalid WPA parameter value for "
"dot11RSNAConfigPMKLifetime"); "dot11RSNAConfigPMKLifetime");
return -1; return -1;
} }
if (wpa_s->conf->dot11RSNAConfigPMKReauthThreshold && if (wpa_s->conf->dot11RSNAConfigPMKReauthThreshold &&
wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD, wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD,
wpa_s->conf->dot11RSNAConfigPMKReauthThreshold)) { wpa_s->conf->dot11RSNAConfigPMKReauthThreshold)) {
wpa_printf(MSG_ERROR, "Invalid WPA parameter value for " wpa_msg(wpa_s, MSG_ERROR, "Invalid WPA parameter value for "
"dot11RSNAConfigPMKReauthThreshold"); "dot11RSNAConfigPMKReauthThreshold");
return -1; return -1;
} }
@ -2112,8 +2117,8 @@ next_driver:
if (wpa_s->conf->dot11RSNAConfigSATimeout && if (wpa_s->conf->dot11RSNAConfigSATimeout &&
wpa_sm_set_param(wpa_s->wpa, RSNA_SA_TIMEOUT, wpa_sm_set_param(wpa_s->wpa, RSNA_SA_TIMEOUT,
wpa_s->conf->dot11RSNAConfigSATimeout)) { wpa_s->conf->dot11RSNAConfigSATimeout)) {
wpa_printf(MSG_ERROR, "Invalid WPA parameter value for " wpa_msg(wpa_s, MSG_ERROR, "Invalid WPA parameter value for "
"dot11RSNAConfigSATimeout"); "dot11RSNAConfigSATimeout");
return -1; return -1;
} }
@ -2135,7 +2140,7 @@ next_driver:
if (wpa_s->conf->country[0] && wpa_s->conf->country[1] && if (wpa_s->conf->country[0] && wpa_s->conf->country[1] &&
wpa_drv_set_country(wpa_s, wpa_s->conf->country)) { wpa_drv_set_country(wpa_s, wpa_s->conf->country)) {
wpa_printf(MSG_DEBUG, "Failed to set country"); wpa_dbg(wpa_s, MSG_DEBUG, "Failed to set country");
return -1; return -1;
} }
@ -2165,14 +2170,14 @@ next_driver:
#ifdef CONFIG_IBSS_RSN #ifdef CONFIG_IBSS_RSN
wpa_s->ibss_rsn = ibss_rsn_init(wpa_s); wpa_s->ibss_rsn = ibss_rsn_init(wpa_s);
if (!wpa_s->ibss_rsn) { if (!wpa_s->ibss_rsn) {
wpa_printf(MSG_DEBUG, "Failed to init IBSS RSN"); wpa_dbg(wpa_s, MSG_DEBUG, "Failed to init IBSS RSN");
return -1; return -1;
} }
#endif /* CONFIG_IBSS_RSN */ #endif /* CONFIG_IBSS_RSN */
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (wpas_p2p_init(wpa_s->global, wpa_s) < 0) { if (wpas_p2p_init(wpa_s->global, wpa_s) < 0) {
wpa_printf(MSG_ERROR, "Failed to init P2P"); wpa_msg(wpa_s, MSG_ERROR, "Failed to init P2P");
return -1; return -1;
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
@ -2269,7 +2274,7 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
wpa_s->next = global->ifaces; wpa_s->next = global->ifaces;
global->ifaces = wpa_s; global->ifaces = wpa_s;
wpa_printf(MSG_DEBUG, "Added interface %s", wpa_s->ifname); wpa_dbg(wpa_s, MSG_DEBUG, "Added interface %s", wpa_s->ifname);
return wpa_s; return wpa_s;
} }
@ -2303,7 +2308,7 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
prev->next = wpa_s->next; prev->next = wpa_s->next;
} }
wpa_printf(MSG_DEBUG, "Removing interface %s", wpa_s->ifname); wpa_dbg(wpa_s, MSG_DEBUG, "Removing interface %s", wpa_s->ifname);
if (global->p2p_group_formation == wpa_s) if (global->p2p_group_formation == wpa_s)
global->p2p_group_formation = NULL; global->p2p_group_formation = NULL;
@ -2637,8 +2642,8 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
*/ */
freqs = get_bss_freqs_in_ess(wpa_s); freqs = get_bss_freqs_in_ess(wpa_s);
if (freqs) { if (freqs) {
wpa_printf(MSG_DEBUG, "Another BSS in this ESS has " wpa_dbg(wpa_s, MSG_DEBUG, "Another BSS in this ESS "
"been seen; try it next"); "has been seen; try it next");
wpa_blacklist_add(wpa_s, bssid); wpa_blacklist_add(wpa_s, bssid);
/* /*
* On the next scan, go through only the known channels * On the next scan, go through only the known channels