[PATCH 3/6] nl80211: Convert some wpa_printf to wpa_msg methods (2).
greearb at candelatech.com
greearb
Wed Oct 19 12:20:16 PDT 2011
From: Ben Greear <greearb at candelatech.com>
This helps debugging when you have multiple interfaces
handled by a single process.
Signed-off-by: Ben Greear <greearb at candelatech.com>
---
:100644 100644 6b4c61b... 372ddf3... M src/drivers/driver_nl80211.c
src/drivers/driver_nl80211.c | 246 ++++++++++++++++++++++--------------------
1 files changed, 127 insertions(+), 119 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6b4c61b..372ddf3 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2044,9 +2044,9 @@ static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
if (ret >= 0)
ret = nl_socket_add_membership(drv->nl_handle_event, ret);
if (ret < 0) {
- wpa_printf(MSG_ERROR, "nl80211: Could not add multicast "
- "membership for scan events: %d (%s)",
- ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Could not add multicast "
+ "membership for scan events: %d (%s)",
+ ret, strerror(-ret));
goto err4;
}
@@ -2054,9 +2054,9 @@ static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
if (ret >= 0)
ret = nl_socket_add_membership(drv->nl_handle_event, ret);
if (ret < 0) {
- wpa_printf(MSG_ERROR, "nl80211: Could not add multicast "
- "membership for mlme events: %d (%s)",
- ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Could not add multicast "
+ "membership for mlme events: %d (%s)",
+ ret, strerror(-ret));
goto err4;
}
@@ -2064,9 +2064,9 @@ static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
if (ret >= 0)
ret = nl_socket_add_membership(drv->nl_handle_event, ret);
if (ret < 0) {
- wpa_printf(MSG_DEBUG, "nl80211: Could not add multicast "
- "membership for regulatory events: %d (%s)",
- ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Could not add multicast "
+ "membership for regulatory events: %d (%s)",
+ ret, strerror(-ret));
/* Continue without regulatory events */
}
@@ -2093,7 +2093,8 @@ err1:
static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
{
- wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
+ struct wpa_driver_nl80211_data *drv = ctx;
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: RFKILL blocked");
/*
* This may be for any interface; use ifdown event to disable
* interface.
@@ -2104,10 +2105,10 @@ static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
static void wpa_driver_nl80211_rfkill_unblocked(void *ctx)
{
struct wpa_driver_nl80211_data *drv = ctx;
- wpa_printf(MSG_DEBUG, "nl80211: RFKILL unblocked");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: RFKILL unblocked");
if (linux_set_iface_flags(drv->ioctl_sock, drv->first_bss.ifname, 1)) {
- wpa_printf(MSG_DEBUG, "nl80211: Could not set interface UP "
- "after rfkill unblock");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Could not set interface UP "
+ "after rfkill unblock");
return;
}
/* rtnetlink ifup handler will report interface as enabled */
@@ -2125,16 +2126,16 @@ static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
drv->first_bss.ifname);
f = open(buf, O_RDONLY);
if (f < 0) {
- wpa_printf(MSG_DEBUG, "Could not open file %s: %s",
- buf, strerror(errno));
+ wpa_msg(drv->ctx, MSG_DEBUG, "Could not open file %s: %s",
+ buf, strerror(errno));
return;
}
rv = read(f, drv->phyname, sizeof(drv->phyname) - 1);
close(f);
if (rv < 0) {
- wpa_printf(MSG_DEBUG, "Could not read file %s: %s",
- buf, strerror(errno));
+ wpa_msg(drv->ctx, MSG_DEBUG, "Could not read file %s: %s",
+ buf, strerror(errno));
return;
}
@@ -2142,8 +2143,8 @@ static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
pos = os_strchr(drv->phyname, '\n');
if (pos)
*pos = '\0';
- wpa_printf(MSG_DEBUG, "nl80211: interface %s in phy %s",
- drv->first_bss.ifname, drv->phyname);
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: interface %s in phy %s",
+ drv->first_bss.ifname, drv->phyname);
}
@@ -2207,7 +2208,7 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname,
rcfg->unblocked_cb = wpa_driver_nl80211_rfkill_unblocked;
drv->rfkill = rfkill_init(rcfg);
if (drv->rfkill == NULL) {
- wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: RFKILL status not available");
os_free(rcfg);
}
@@ -2261,9 +2262,9 @@ static int nl80211_register_frame(struct wpa_driver_nl80211_data *drv,
ret = send_and_recv(drv, nl_handle, msg, NULL, NULL);
msg = NULL;
if (ret) {
- wpa_printf(MSG_DEBUG, "nl80211: Register frame command "
- "failed (type=%u): ret=%d (%s)",
- type, ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Register frame command "
+ "failed (type=%u): ret=%d (%s)",
+ type, ret, strerror(-ret));
wpa_hexdump(MSG_DEBUG, "nl80211: Register frame match",
match, match_len);
goto nla_put_failure;
@@ -2357,20 +2358,21 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
if ((drv->global == NULL ||
drv->ifindex != drv->global->if_add_ifindex) &&
wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
- wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
- "use managed mode");
+ wpa_msg(drv->ctx, MSG_DEBUG,
+ "nl80211: Could not configure driver to "
+ "use managed mode");
}
if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
if (rfkill_is_blocked(drv->rfkill)) {
- wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
- "interface '%s' due to rfkill",
- bss->ifname);
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Could not yet enable "
+ "interface '%s' due to rfkill",
+ bss->ifname);
drv->if_disabled = 1;
send_rfkill_event = 1;
} else {
- wpa_printf(MSG_ERROR, "nl80211: Could not set "
- "interface '%s' UP", bss->ifname);
+ wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Could not set "
+ "interface '%s' UP", bss->ifname);
return -1;
}
}
@@ -2386,8 +2388,8 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
return -1;
if (nl80211_register_action_frames(drv) < 0) {
- wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
- "frame processing - ignore for now");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to register Action "
+ "frame processing - ignore for now");
/*
* Older kernel versions did not support this, so ignore the
* error for now. Some functionality may not be available
@@ -2444,15 +2446,15 @@ static void wpa_driver_nl80211_deinit(void *priv)
if (bss->added_if_into_bridge) {
if (linux_br_del_if(drv->ioctl_sock, bss->brname, bss->ifname)
< 0)
- wpa_printf(MSG_INFO, "nl80211: Failed to remove "
- "interface %s from bridge %s: %s",
- bss->ifname, bss->brname, strerror(errno));
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: Failed to remove "
+ "interface %s from bridge %s: %s",
+ bss->ifname, bss->brname, strerror(errno));
}
if (bss->added_bridge) {
if (linux_br_del(drv->ioctl_sock, bss->brname) < 0)
- wpa_printf(MSG_INFO, "nl80211: Failed to remove "
- "bridge %s: %s",
- bss->brname, strerror(errno));
+ wpa_msg(drv->ctx, MSG_INFO, "nl80211: Failed to remove "
+ "bridge %s: %s",
+ bss->brname, strerror(errno));
}
nl80211_remove_monitor_interface(drv);
@@ -2525,7 +2527,7 @@ static void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx)
drv->ap_scan_as_station);
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
}
- wpa_printf(MSG_DEBUG, "Scan timeout - try to get results");
+ wpa_msg(drv->ctx, MSG_DEBUG, "Scan timeout - try to get results");
wpa_supplicant_event(timeout_ctx, EVENT_SCAN_RESULTS, NULL);
}
@@ -2646,8 +2648,9 @@ static int wpa_driver_nl80211_scan(void *priv,
*/
timeout = 30;
}
- wpa_printf(MSG_DEBUG, "Scan requested (ret=%d) - scan timeout %d "
- "seconds", ret, timeout);
+ wpa_msg(drv->ctx, MSG_DEBUG,
+ "Scan requested (ret=%d) - scan timeout %d "
+ "seconds", ret, timeout);
eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
eloop_register_timeout(timeout, 0, wpa_driver_nl80211_scan_timeout,
drv, drv->ctx);
@@ -3029,8 +3032,8 @@ static void clear_state_mismatch(struct wpa_driver_nl80211_data *drv,
const u8 *addr)
{
if (drv->capa.flags & WPA_DRIVER_FLAGS_SME) {
- wpa_printf(MSG_DEBUG, "nl80211: Clear possible state "
- "mismatch (" MACSTR ")", MAC2STR(addr));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Clear possible state "
+ "mismatch (" MACSTR ")", MAC2STR(addr));
wpa_driver_nl80211_mlme(drv, addr,
NL80211_CMD_DEAUTHENTICATE,
WLAN_REASON_PREV_AUTH_NOT_VALID, 1);
@@ -3046,41 +3049,43 @@ static void wpa_driver_nl80211_check_bss_status(
for (i = 0; i < res->num; i++) {
struct wpa_scan_res *r = res->res[i];
if (r->flags & WPA_SCAN_AUTHENTICATED) {
- wpa_printf(MSG_DEBUG, "nl80211: Scan results "
- "indicates BSS status with " MACSTR
- " as authenticated",
- MAC2STR(r->bssid));
+ wpa_msg(drv->ctx, MSG_DEBUG,
+ "nl80211: Scan results "
+ "indicates BSS status with " MACSTR
+ " as authenticated",
+ MAC2STR(r->bssid));
if (is_sta_interface(drv->nlmode) &&
os_memcmp(r->bssid, drv->bssid, ETH_ALEN) != 0 &&
os_memcmp(r->bssid, drv->auth_bssid, ETH_ALEN) !=
0) {
- wpa_printf(MSG_DEBUG, "nl80211: Unknown BSSID"
- " in local state (auth=" MACSTR
- " assoc=" MACSTR ")",
- MAC2STR(drv->auth_bssid),
- MAC2STR(drv->bssid));
+ wpa_msg(drv->ctx, MSG_DEBUG,
+ "nl80211: Unknown BSSID"
+ " in local state (auth=" MACSTR
+ " assoc=" MACSTR ")",
+ MAC2STR(drv->auth_bssid),
+ MAC2STR(drv->bssid));
clear_state_mismatch(drv, r->bssid);
}
}
if (r->flags & WPA_SCAN_ASSOCIATED) {
- wpa_printf(MSG_DEBUG, "nl80211: Scan results "
- "indicate BSS status with " MACSTR
- " as associated",
- MAC2STR(r->bssid));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Scan results "
+ "indicate BSS status with " MACSTR
+ " as associated",
+ MAC2STR(r->bssid));
if (is_sta_interface(drv->nlmode) &&
!drv->associated) {
- wpa_printf(MSG_DEBUG, "nl80211: Local state "
- "(not associated) does not match "
- "with BSS state");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Local state "
+ "(not associated) does not match "
+ "with BSS state");
clear_state_mismatch(drv, r->bssid);
} else if (is_sta_interface(drv->nlmode) &&
os_memcmp(drv->bssid, r->bssid, ETH_ALEN) !=
0) {
- wpa_printf(MSG_DEBUG, "nl80211: Local state "
- "(associated with " MACSTR ") does "
- "not match with BSS state",
- MAC2STR(drv->bssid));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Local state "
+ "(associated with " MACSTR ") does "
+ "not match with BSS state",
+ MAC2STR(drv->bssid));
clear_state_mismatch(drv, r->bssid);
clear_state_mismatch(drv, drv->bssid);
}
@@ -3127,12 +3132,12 @@ nl80211_get_scan_results(struct wpa_driver_nl80211_data *drv)
ret = send_and_recv_msgs(drv, msg, bss_info_handler, &arg);
msg = NULL;
if (ret == 0) {
- wpa_printf(MSG_DEBUG, "Received scan results (%lu BSSes)",
- (unsigned long) res->num);
+ wpa_msg(drv->ctx, MSG_DEBUG, "Received scan results (%lu BSSes)",
+ (unsigned long) res->num);
return res;
}
- wpa_printf(MSG_DEBUG, "nl80211: Scan result fetch failed: ret=%d "
- "(%s)", ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Scan result fetch failed: ret=%d "
+ "(%s)", ret, strerror(-ret));
nla_put_failure:
nlmsg_free(msg);
wpa_scan_results_free(res);
@@ -3166,17 +3171,17 @@ static void nl80211_dump_scan(struct wpa_driver_nl80211_data *drv)
res = nl80211_get_scan_results(drv);
if (res == NULL) {
- wpa_printf(MSG_DEBUG, "nl80211: Failed to get scan results");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to get scan results");
return;
}
- wpa_printf(MSG_DEBUG, "nl80211: Scan result dump");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Scan result dump");
for (i = 0; i < res->num; i++) {
struct wpa_scan_res *r = res->res[i];
- wpa_printf(MSG_DEBUG, "nl80211: %d/%d " MACSTR "%s%s",
- (int) i, (int) res->num, MAC2STR(r->bssid),
- r->flags & WPA_SCAN_AUTHENTICATED ? " [auth]" : "",
- r->flags & WPA_SCAN_ASSOCIATED ? " [assoc]" : "");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: %d/%d " MACSTR "%s%s",
+ (int) i, (int) res->num, MAC2STR(r->bssid),
+ r->flags & WPA_SCAN_AUTHENTICATED ? " [auth]" : "",
+ r->flags & WPA_SCAN_ASSOCIATED ? " [assoc]" : "");
}
wpa_scan_results_free(res);
@@ -3195,10 +3200,10 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
struct nl_msg *msg;
int ret;
- wpa_printf(MSG_DEBUG, "%s: ifindex=%d alg=%d addr=%p key_idx=%d "
- "set_tx=%d seq_len=%lu key_len=%lu",
- __func__, ifindex, alg, addr, key_idx, set_tx,
- (unsigned long) seq_len, (unsigned long) key_len);
+ wpa_msg(drv->ctx, MSG_DEBUG, "%s: ifindex=%d alg=%d addr=%p key_idx=%d "
+ "set_tx=%d seq_len=%lu key_len=%lu",
+ __func__, ifindex, alg, addr, key_idx, set_tx,
+ (unsigned long) seq_len, (unsigned long) key_len);
msg = nlmsg_alloc();
if (!msg)
@@ -3233,8 +3238,8 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
WLAN_CIPHER_SUITE_AES_CMAC);
break;
default:
- wpa_printf(MSG_ERROR, "%s: Unsupported encryption "
- "algorithm %d", __func__, alg);
+ wpa_msg(drv->ctx, MSG_ERROR, "%s: Unsupported encryption "
+ "algorithm %d", __func__, alg);
nlmsg_free(msg);
return -1;
}
@@ -3244,11 +3249,12 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, seq_len, seq);
if (addr && !is_broadcast_ether_addr(addr)) {
- wpa_printf(MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr));
+ wpa_msg(drv->ctx, MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr));
+
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
if (alg != WPA_ALG_WEP && key_idx && !set_tx) {
- wpa_printf(MSG_DEBUG, " RSN IBSS RX GTK");
+ wpa_msg(drv->ctx, MSG_DEBUG, " RSN IBSS RX GTK");
NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE,
NL80211_KEYTYPE_GROUP);
}
@@ -3273,8 +3279,8 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
if ((ret == -ENOENT || ret == -ENOLINK) && alg == WPA_ALG_NONE)
ret = 0;
if (ret)
- wpa_printf(MSG_DEBUG, "nl80211: set_key failed; err=%d %s)",
- ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: set_key failed; err=%d %s)",
+ ret, strerror(-ret));
/*
* If we failed or don't need to set the default TX key (below),
@@ -3328,8 +3334,8 @@ static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
if (ret == -ENOENT)
ret = 0;
if (ret)
- wpa_printf(MSG_DEBUG, "nl80211: set_key default failed; "
- "err=%d %s)", ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: set_key default failed; "
+ "err=%d %s)", ret, strerror(-ret));
return ret;
nla_put_failure:
@@ -3337,7 +3343,8 @@ nla_put_failure:
}
-static int nl_add_key(struct nl_msg *msg, enum wpa_alg alg,
+static int nl_add_key(struct wpa_driver_nl80211_data *drv,
+ struct nl_msg *msg, enum wpa_alg alg,
int key_idx, int defkey,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
@@ -3373,8 +3380,8 @@ static int nl_add_key(struct nl_msg *msg, enum wpa_alg alg,
WLAN_CIPHER_SUITE_AES_CMAC);
break;
default:
- wpa_printf(MSG_ERROR, "%s: Unsupported encryption "
- "algorithm %d", __func__, alg);
+ wpa_msg(drv->ctx, MSG_ERROR, "%s: Unsupported encryption "
+ "algorithm %d", __func__, alg);
return -1;
}
@@ -3473,8 +3480,8 @@ static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
msg = NULL;
if (ret) {
- wpa_printf(MSG_DEBUG, "nl80211: MLME command failed: ret=%d "
- "(%s)", ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: MLME command failed: ret=%d "
+ "(%s)", ret, strerror(-ret));
goto nla_put_failure;
}
ret = 0;
@@ -3488,8 +3495,8 @@ nla_put_failure:
static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
const u8 *addr, int reason_code)
{
- wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " reason_code=%d)",
- __func__, MAC2STR(addr), reason_code);
+ wpa_msg(drv->ctx, MSG_DEBUG, "%s(addr=" MACSTR " reason_code=%d)",
+ __func__, MAC2STR(addr), reason_code);
drv->associated = 0;
return wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DISCONNECT,
reason_code, 0);
@@ -3503,8 +3510,8 @@ static int wpa_driver_nl80211_deauthenticate(void *priv, const u8 *addr,
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME))
return wpa_driver_nl80211_disconnect(drv, addr, reason_code);
- wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " reason_code=%d)",
- __func__, MAC2STR(addr), reason_code);
+ wpa_msg(drv->ctx, MSG_DEBUG, "%s(addr=" MACSTR " reason_code=%d)",
+ __func__, MAC2STR(addr), reason_code);
drv->associated = 0;
if (drv->nlmode == NL80211_IFTYPE_ADHOC)
return nl80211_leave_ibss(drv);
@@ -3520,7 +3527,7 @@ static int wpa_driver_nl80211_disassociate(void *priv, const u8 *addr,
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME))
return wpa_driver_nl80211_disconnect(drv, addr, reason_code);
- wpa_printf(MSG_DEBUG, "%s", __func__);
+ wpa_msg(drv->ctx, MSG_DEBUG, "%s", __func__);
drv->associated = 0;
return wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DISASSOCIATE,
reason_code, 0);
@@ -3552,8 +3559,8 @@ retry:
if (!msg)
return -1;
- wpa_printf(MSG_DEBUG, "nl80211: Authenticate (ifindex=%d)",
- drv->ifindex);
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Authenticate (ifindex=%d)",
+ drv->ifindex);
genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
NL80211_CMD_AUTHENTICATE, 0);
@@ -3568,7 +3575,7 @@ retry:
params->wep_key_len[i]);
if (params->wep_tx_keyidx != i)
continue;
- if (nl_add_key(msg, WPA_ALG_WEP, i, 1, NULL, 0,
+ if (nl_add_key(drv, msg, WPA_ALG_WEP, i, 1, NULL, 0,
params->wep_key[i], params->wep_key_len[i])) {
nlmsg_free(msg);
return -1;
@@ -3577,12 +3584,12 @@ retry:
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
if (params->bssid) {
- wpa_printf(MSG_DEBUG, " * bssid=" MACSTR,
- MAC2STR(params->bssid));
+ wpa_msg(drv->ctx, MSG_DEBUG, " * bssid=" MACSTR,
+ MAC2STR(params->bssid));
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, params->bssid);
}
if (params->freq) {
- wpa_printf(MSG_DEBUG, " * freq=%d", params->freq);
+ wpa_msg(drv->ctx, MSG_DEBUG, " * freq=%d", params->freq);
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, params->freq);
}
if (params->ssid) {
@@ -3604,18 +3611,18 @@ retry:
type = NL80211_AUTHTYPE_FT;
else
goto nla_put_failure;
- wpa_printf(MSG_DEBUG, " * Auth Type %d", type);
+ wpa_msg(drv->ctx, MSG_DEBUG, " * Auth Type %d", type);
NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE, type);
if (params->local_state_change) {
- wpa_printf(MSG_DEBUG, " * Local state change only");
+ wpa_msg(drv->ctx, MSG_DEBUG, " * Local state change only");
NLA_PUT_FLAG(msg, NL80211_ATTR_LOCAL_STATE_CHANGE);
}
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
msg = NULL;
if (ret) {
- wpa_printf(MSG_DEBUG, "nl80211: MLME command failed: ret=%d "
- "(%s)", ret, strerror(-ret));
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: MLME command failed: ret=%d "
+ "(%s)", ret, strerror(-ret));
count++;
if (ret == -EALREADY && count == 1 && params->bssid &&
!params->local_state_change) {
@@ -3624,8 +3631,8 @@ retry:
* authentication if we are already authenticated. As a
* workaround, force deauthentication and try again.
*/
- wpa_printf(MSG_DEBUG, "nl80211: Retry authentication "
- "after forced deauthentication");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Retry authentication "
+ "after forced deauthentication");
wpa_driver_nl80211_deauthenticate(
bss, params->bssid,
WLAN_REASON_PREV_AUTH_NOT_VALID);
@@ -3635,8 +3642,8 @@ retry:
goto nla_put_failure;
}
ret = 0;
- wpa_printf(MSG_DEBUG, "nl80211: Authentication request send "
- "successfully");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Authentication request send "
+ "successfully");
nla_put_failure:
nlmsg_free(msg);
@@ -3821,7 +3828,8 @@ static int phy_info_handler(struct nl_msg *msg, void *arg)
}
static struct hostapd_hw_modes *
-wpa_driver_nl80211_add_11b(struct hostapd_hw_modes *modes, u16 *num_modes)
+wpa_driver_nl80211_add_11b(struct wpa_driver_nl80211_data *drv,
+ struct hostapd_hw_modes *modes, u16 *num_modes)
{
u16 m;
struct hostapd_hw_modes *mode11g = NULL, *nmodes, *mode;
@@ -3887,8 +3895,8 @@ wpa_driver_nl80211_add_11b(struct hostapd_hw_modes *modes, u16 *num_modes)
return modes; /* No 802.11b rates */
}
- wpa_printf(MSG_DEBUG, "nl80211: Added 802.11b mode based on 802.11g "
- "information");
+ wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Added 802.11b mode based on 802.11g "
+ "information");
return modes;
}
@@ -3939,8 +3947,8 @@ static void nl80211_reg_rule_ht40(struct nlattr *tb[],
end = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]) / 1000;
max_bw = nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) / 1000;
- wpa_printf(MSG_DEBUG, "nl80211: %u-%u @ %u MHz",
- start, end, max_bw);
+ wpa_msg(NULL, MSG_DEBUG, "nl80211: %u-%u @ %u MHz",
+ start, end, max_bw);
if (max_bw < 40)
return;
@@ -4001,13 +4009,13 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
genlmsg_attrlen(gnlh, 0), NULL);
if (!tb_msg[NL80211_ATTR_REG_ALPHA2] ||
!tb_msg[NL80211_ATTR_REG_RULES]) {
- wpa_printf(MSG_DEBUG, "nl80211: No regulatory information "
- "available");
+ wpa_msg(NULL, MSG_DEBUG, "nl80211: No regulatory information "
+ "available");
return NL_SKIP;
}
- wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s",
- (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]));
+ wpa_msg(NULL, MSG_DEBUG, "nl80211: Regulatory information - country=%s",
+ (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]));
nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule)
{
@@ -4067,7 +4075,7 @@ wpa_driver_nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
if (send_and_recv_msgs(drv, msg, phy_info_handler, &result) == 0) {
nl80211_set_ht40_flags(drv, &result);
- return wpa_driver_nl80211_add_11b(result.modes, num_modes);
+ return wpa_driver_nl80211_add_11b(drv, result.modes, num_modes);
}
nla_put_failure:
return NULL;
--
1.7.3.4
More information about the Hostap
mailing list