[PATCH 6/6] nl80211: Convert some wpa_printf to wpa_msg methods (4-b).

greearb at candelatech.com greearb
Wed Oct 19 12:20:19 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 ed62cdd... f9be405... M	src/drivers/driver_nl80211.c
 src/drivers/driver_nl80211.c |  243 ++++++++++++++++++++++--------------------
 1 files changed, 125 insertions(+), 118 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index ed62cdd..f9be405 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5728,8 +5728,8 @@ static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv,
 	if (!ret)
 		return 0;
 nla_put_failure:
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to set interface %d to mode %d:"
-		   " %d (%s)", ifindex, mode, ret, strerror(-ret));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to set interface %d to mode %d:"
+		" %d (%s)", ifindex, mode, ret, strerror(-ret));
 	return ret;
 }
 
@@ -5749,8 +5749,8 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
 	}
 
 	if (nlmode == drv->nlmode) {
-		wpa_printf(MSG_DEBUG, "nl80211: Interface already in "
-			   "requested mode - ignore error");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Interface already in "
+			"requested mode - ignore error");
 		ret = 0;
 		goto done; /* Already in the requested mode */
 	}
@@ -5759,8 +5759,8 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
 	 * take the device down, try to set the mode again, and bring the
 	 * device back up.
 	 */
-	wpa_printf(MSG_DEBUG, "nl80211: Try mode change after setting "
-		   "interface down");
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Try mode change after setting "
+		"interface down");
 	for (i = 0; i < 10; i++) {
 		if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 0) ==
 		    0) {
@@ -5773,14 +5773,14 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss,
 			if (!ret)
 				break;
 		} else
-			wpa_printf(MSG_DEBUG, "nl80211: Failed to set "
-				   "interface down");
+			wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to set "
+				"interface down");
 		os_sleep(0, 100000);
 	}
 
 	if (!ret) {
-		wpa_printf(MSG_DEBUG, "nl80211: Mode change succeeded while "
-			   "interface is down");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Mode change succeeded while "
+			"interface is down");
 		drv->nlmode = nlmode;
 		drv->ignore_if_down_event = 1;
 	}
@@ -5801,8 +5801,8 @@ done:
 	}
 
 	if (ret)
-		wpa_printf(MSG_DEBUG, "nl80211: Interface mode change to %d "
-			   "from %d failed", nlmode, drv->nlmode);
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Interface mode change to %d "
+			"from %d failed", nlmode, drv->nlmode);
 
 	return ret;
 }
@@ -5825,8 +5825,8 @@ static int wpa_driver_nl80211_set_operstate(void *priv, int state)
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 
-	wpa_printf(MSG_DEBUG, "%s: operstate %d->%d (%s)",
-		   __func__, drv->operstate, state, state ? "UP" : "DORMANT");
+	wpa_msg(drv->ctx, MSG_DEBUG, "%s: operstate %d->%d (%s)",
+		__func__, drv->operstate, state, state ? "UP" : "DORMANT");
 	drv->operstate = state;
 	return netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, -1,
 				      state ? IF_OPER_UP : IF_OPER_DORMANT);
@@ -5987,8 +5987,8 @@ static int i802_set_rts(void *priv, int rts)
 	if (!ret)
 		return 0;
 nla_put_failure:
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to set RTS threshold %d: "
-		   "%d (%s)", rts, ret, strerror(-ret));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to set RTS threshold %d: "
+		"%d (%s)", rts, ret, strerror(-ret));
 	return ret;
 }
 
@@ -6019,8 +6019,8 @@ static int i802_set_frag(void *priv, int frag)
 	if (!ret)
 		return 0;
 nla_put_failure:
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to set fragmentation threshold "
-		   "%d: %d (%s)", frag, ret, strerror(-ret));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to set fragmentation threshold "
+		"%d: %d (%s)", frag, ret, strerror(-ret));
 	return ret;
 }
 
@@ -6074,13 +6074,13 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
 	 */
 
 	if (!tb[NL80211_ATTR_STA_INFO]) {
-		wpa_printf(MSG_DEBUG, "sta stats missing!");
+		wpa_msg(NULL, MSG_DEBUG, "sta stats missing!");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(stats, NL80211_STA_INFO_MAX,
 			     tb[NL80211_ATTR_STA_INFO],
 			     stats_policy)) {
-		wpa_printf(MSG_DEBUG, "failed to parse nested attributes!");
+		wpa_msg(NULL, MSG_DEBUG, "failed to parse nested attributes!");
 		return NL_SKIP;
 	}
 
@@ -6206,10 +6206,10 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret < 0) {
-		wpa_printf(MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr="
-			   MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)",
-			   MAC2STR(addr), ifname, vlan_id, ret,
-			   strerror(-ret));
+		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr="
+			MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)",
+			MAC2STR(addr), ifname, vlan_id, ret,
+			strerror(-ret));
 	}
  nla_put_failure:
 	return ret;
@@ -6284,8 +6284,8 @@ static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
 	int i;
 	int *old;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Add own interface ifindex %d",
-		   ifidx);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Add own interface ifindex %d",
+		ifidx);
 	for (i = 0; i < drv->num_if_indices; i++) {
 		if (drv->if_indices[i] == 0) {
 			drv->if_indices[i] = ifidx;
@@ -6305,9 +6305,9 @@ static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
 			drv->if_indices = drv->default_if_indices;
 		else
 			drv->if_indices = old;
-		wpa_printf(MSG_ERROR, "Failed to reallocate memory for "
-			   "interfaces");
-		wpa_printf(MSG_ERROR, "Ignoring EAPOL on interface %d", ifidx);
+		wpa_msg(drv->ctx, MSG_ERROR, "Failed to reallocate memory for "
+			"interfaces");
+		wpa_msg(drv->ctx, MSG_ERROR, "Ignoring EAPOL on interface %d", ifidx);
 		return;
 	} else if (!old)
 		os_memcpy(drv->if_indices, drv->default_if_indices,
@@ -6350,8 +6350,8 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
 	char name[IFNAMSIZ + 1];
 
 	os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid);
-	wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
-		   " aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
+		" aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
 	if (val) {
 		if (!if_nametoindex(name)) {
 			if (nl80211_create_iface(drv, name,
@@ -6408,9 +6408,9 @@ static int i802_check_bridge(struct wpa_driver_nl80211_data *drv,
 		 * not exist. Try to add it now.
 		 */
 		if (linux_br_add(drv->ioctl_sock, brname) < 0) {
-			wpa_printf(MSG_ERROR, "nl80211: Failed to add the "
-				   "bridge interface %s: %s",
-				   brname, strerror(errno));
+			wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to add the "
+				"bridge interface %s: %s",
+				brname, strerror(errno));
 			return -1;
 		}
 		bss->added_bridge = 1;
@@ -6421,23 +6421,23 @@ static int i802_check_bridge(struct wpa_driver_nl80211_data *drv,
 		if (os_strcmp(in_br, brname) == 0)
 			return 0; /* already in the bridge */
 
-		wpa_printf(MSG_DEBUG, "nl80211: Removing interface %s from "
-			   "bridge %s", ifname, in_br);
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Removing interface %s from "
+			"bridge %s", ifname, in_br);
 		if (linux_br_del_if(drv->ioctl_sock, in_br, ifname) < 0) {
-			wpa_printf(MSG_ERROR, "nl80211: Failed to "
-				   "remove interface %s from bridge "
-				   "%s: %s",
-				   ifname, brname, strerror(errno));
+			wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to "
+				"remove interface %s from bridge "
+				"%s: %s",
+				ifname, brname, strerror(errno));
 			return -1;
 		}
 	}
 
-	wpa_printf(MSG_DEBUG, "nl80211: Adding interface %s into bridge %s",
-		   ifname, brname);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Adding interface %s into bridge %s",
+		ifname, brname);
 	if (linux_br_add_if(drv->ioctl_sock, brname, ifname) < 0) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to add interface %s "
-			   "into bridge %s: %s",
-			   ifname, brname, strerror(errno));
+		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to add interface %s "
+			"into bridge %s: %s",
+			ifname, brname, strerror(errno));
 		return -1;
 	}
 	bss->added_if_into_bridge = 1;
@@ -6463,8 +6463,8 @@ static void *i802_init(struct hostapd_data *hapd,
 	drv = bss->drv;
 	drv->nlmode = NL80211_IFTYPE_AP;
 	if (linux_br_get(brname, params->ifname) == 0) {
-		wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
-			   params->ifname, brname);
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
+			params->ifname, brname);
 		br_ifindex = if_nametoindex(brname);
 	} else {
 		brname[0] = '\0';
@@ -6499,8 +6499,9 @@ static void *i802_init(struct hostapd_data *hapd,
 	}
 
 	if (wpa_driver_nl80211_set_mode(bss, drv->nlmode)) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to set interface %s "
-			   "into AP mode", bss->ifname);
+		wpa_msg(drv->ctx, MSG_ERROR,
+			"nl80211: Failed to set interface %s "
+			"into AP mode", bss->ifname);
 		goto failed;
 	}
 
@@ -6605,8 +6606,8 @@ static int nl80211_p2p_interface_addr(struct wpa_driver_nl80211_data *drv,
 	if (idx == 64)
 		return -1;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Assigned new P2P Interface Address "
-		   MACSTR, MAC2STR(new_addr));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Assigned new P2P Interface Address "
+		MACSTR, MAC2STR(new_addr));
 
 	return 0;
 }
@@ -6666,8 +6667,8 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
 			return -1;
 		}
 		if (os_memcmp(own_addr, new_addr, ETH_ALEN) == 0) {
-			wpa_printf(MSG_DEBUG, "nl80211: Allocate new address "
-				   "for P2P group interface");
+			wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Allocate new address "
+				"for P2P group interface");
 			if (nl80211_p2p_interface_addr(drv, new_addr) < 0) {
 				nl80211_remove_iface(drv, ifidx);
 				return -1;
@@ -6685,8 +6686,9 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
 #ifdef HOSTAPD
 	if (bridge &&
 	    i802_check_bridge(drv, new_bss, bridge, ifname) < 0) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to add the new "
-			   "interface %s to a bridge %s", ifname, bridge);
+		wpa_msg(drv->ctx, MSG_ERROR,
+			"nl80211: Failed to add the new "
+			"interface %s to a bridge %s", ifname, bridge);
 		nl80211_remove_iface(drv, ifidx);
 		os_free(new_bss);
 		return -1;
@@ -6723,8 +6725,8 @@ static int wpa_driver_nl80211_if_remove(void *priv,
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	int ifindex = if_nametoindex(ifname);
 
-	wpa_printf(MSG_DEBUG, "nl80211: %s(type=%d ifname=%s) ifindex=%d",
-		   __func__, type, ifname, ifindex);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: %s(type=%d ifname=%s) ifindex=%d",
+		__func__, type, ifname, ifindex);
 	if (ifindex <= 0)
 		return -1;
 
@@ -6732,15 +6734,15 @@ static int wpa_driver_nl80211_if_remove(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));
 	}
 #endif /* HOSTAPD */
 
@@ -6762,8 +6764,9 @@ static int wpa_driver_nl80211_if_remove(void *priv,
 			}
 		}
 		if (bss)
-			wpa_printf(MSG_INFO, "nl80211: %s - could not find "
-				   "BSS %p in the list", __func__, bss);
+			wpa_msg(drv->ctx, MSG_INFO,
+				"nl80211: %s - could not find "
+				"BSS %p in the list", __func__, bss);
 	}
 #endif /* HOSTAPD */
 
@@ -6811,13 +6814,14 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
 	ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie);
 	msg = NULL;
 	if (ret) {
-		wpa_printf(MSG_DEBUG, "nl80211: Frame command failed: ret=%d "
-			   "(%s) (freq=%u wait=%u)", ret, strerror(-ret),
-			   freq, wait);
+		wpa_msg(drv->ctx, MSG_DEBUG,
+			"nl80211: Frame command failed: ret=%d "
+			"(%s) (freq=%u wait=%u)", ret, strerror(-ret),
+			freq, wait);
 		goto nla_put_failure;
 	}
-	wpa_printf(MSG_DEBUG, "nl80211: Frame TX command accepted; "
-		   "cookie 0x%llx", (long long unsigned int) cookie);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Frame TX command accepted; "
+		"cookie 0x%llx", (long long unsigned int) cookie);
 
 	if (cookie_out)
 		*cookie_out = cookie;
@@ -6840,7 +6844,7 @@ static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq,
 	u8 *buf;
 	struct ieee80211_hdr *hdr;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
 		   "wait=%d ms)", drv->ifindex, wait_time);
 
 	buf = os_zalloc(24 + data_len);
@@ -6886,8 +6890,9 @@ static void wpa_driver_nl80211_send_action_cancel_wait(void *priv)
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	msg = NULL;
 	if (ret)
-		wpa_printf(MSG_DEBUG, "nl80211: wait cancel failed: ret=%d "
-			   "(%s)", ret, strerror(-ret));
+		wpa_msg(drv->ctx, MSG_DEBUG,
+			"nl80211: wait cancel failed: ret=%d (%s)",
+			ret, strerror(-ret));
 
  nla_put_failure:
 	nlmsg_free(msg);
@@ -6917,16 +6922,16 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
 	cookie = 0;
 	ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie);
 	if (ret == 0) {
-		wpa_printf(MSG_DEBUG, "nl80211: Remain-on-channel cookie "
-			   "0x%llx for freq=%u MHz duration=%u",
-			   (long long unsigned int) cookie, freq, duration);
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Remain-on-channel cookie "
+			"0x%llx for freq=%u MHz duration=%u",
+			(long long unsigned int) cookie, freq, duration);
 		drv->remain_on_chan_cookie = cookie;
 		drv->pending_remain_on_chan = 1;
 		return 0;
 	}
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to request remain-on-channel "
-		   "(freq=%d duration=%u): %d (%s)",
-		   freq, duration, ret, strerror(-ret));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to request remain-on-channel "
+		"(freq=%d duration=%u): %d (%s)",
+		freq, duration, ret, strerror(-ret));
 nla_put_failure:
 	return -1;
 }
@@ -6940,14 +6945,14 @@ static int wpa_driver_nl80211_cancel_remain_on_channel(void *priv)
 	int ret;
 
 	if (!drv->pending_remain_on_chan) {
-		wpa_printf(MSG_DEBUG, "nl80211: No pending remain-on-channel "
-			   "to cancel");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: No pending remain-on-channel "
+			"to cancel");
 		return -1;
 	}
 
-	wpa_printf(MSG_DEBUG, "nl80211: Cancel remain-on-channel with cookie "
-		   "0x%llx",
-		   (long long unsigned int) drv->remain_on_chan_cookie);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Cancel remain-on-channel with cookie "
+		"0x%llx",
+		(long long unsigned int) drv->remain_on_chan_cookie);
 
 	msg = nlmsg_alloc();
 	if (!msg)
@@ -6962,8 +6967,8 @@ static int wpa_driver_nl80211_cancel_remain_on_channel(void *priv)
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret == 0)
 		return 0;
-	wpa_printf(MSG_DEBUG, "nl80211: Failed to cancel remain-on-channel: "
-		   "%d (%s)", ret, strerror(-ret));
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to cancel remain-on-channel: "
+		"%d (%s)", ret, strerror(-ret));
 nla_put_failure:
 	return -1;
 }
@@ -6986,37 +6991,38 @@ static int wpa_driver_nl80211_probe_req_report(void *priv, int report)
 	}
 
 	if (drv->nl_handle_preq) {
-		wpa_printf(MSG_DEBUG, "nl80211: Probe Request reporting "
-			   "already on!");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Probe Request reporting "
+			"already on!");
 		return 0;
 	}
 
 	drv->nl_handle_preq = nl80211_handle_alloc(drv->nl_cb);
 	if (drv->nl_handle_preq == NULL) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to allocate "
-			   "netlink callbacks (preq)");
+		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to allocate "
+			"netlink callbacks (preq)");
 		goto out_err1;
 	}
 
 	if (genl_connect(drv->nl_handle_preq)) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to connect to "
-			   "generic netlink (preq)");
+		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Failed to connect to "
+			"generic netlink (preq)");
 		goto out_err2;
-		return -1;
 	}
 
 #ifdef CONFIG_LIBNL20
 	if (genl_ctrl_alloc_cache(drv->nl_handle_preq,
 				  &drv->nl_cache_preq) < 0) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to allocate generic "
-			   "netlink cache (preq)");
+		wpa_msg(drv->ctx, MSG_ERROR,
+			"nl80211: Failed to allocate generic "
+			"netlink cache (preq)");
 		goto out_err2;
 	}
 #else /* CONFIG_LIBNL20 */
 	drv->nl_cache_preq = genl_ctrl_alloc_cache(drv->nl_handle_preq);
 	if (drv->nl_cache_preq == NULL) {
-		wpa_printf(MSG_ERROR, "nl80211: Failed to allocate generic "
-			   "netlink cache (preq)");
+		wpa_msg(drv->ctx, MSG_ERROR,
+			"nl80211: Failed to allocate generic "
+			"netlink cache (preq)");
 		goto out_err2;
 	}
 #endif /* CONFIG_LIBNL20 */
@@ -7080,8 +7086,8 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	msg = NULL;
 	if (ret) {
-		wpa_printf(MSG_DEBUG, "nl80211: Set TX rates failed: ret=%d "
-			   "(%s)", ret, strerror(-ret));
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Set TX rates failed: ret=%d "
+			"(%s)", ret, strerror(-ret));
 	}
 
 	return ret;
@@ -7117,8 +7123,8 @@ static void wpa_driver_nl80211_resume(void *priv)
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
-		wpa_printf(MSG_DEBUG, "nl80211: Failed to set interface up on "
-			   "resume event");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Failed to set interface up on "
+			"resume event");
 	}
 }
 
@@ -7137,8 +7143,8 @@ static int nl80211_send_ft_action(void *priv, u8 action, const u8 *target_ap,
 		return -1;
 
 	if (action != 1) {
-		wpa_printf(MSG_ERROR, "nl80211: Unsupported send_ft_action "
-			   "action %d", action);
+		wpa_msg(drv->ctx, MSG_ERROR, "nl80211: Unsupported send_ft_action "
+			"action %d", action);
 		return -1;
 	}
 
@@ -7179,8 +7185,8 @@ static int nl80211_signal_monitor(void *priv, int threshold, int hysteresis)
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	struct nl_msg *msg, *cqm = NULL;
 
-	wpa_printf(MSG_DEBUG, "nl80211: Signal monitor threshold=%d "
-		   "hysteresis=%d", threshold, hysteresis);
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Signal monitor threshold=%d "
+		"hysteresis=%d", threshold, hysteresis);
 
 	msg = nlmsg_alloc();
 	if (!msg)
@@ -7237,17 +7243,17 @@ static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len,
 
 static int nl80211_set_param(void *priv, const char *param)
 {
-	wpa_printf(MSG_DEBUG, "nl80211: driver param='%s'", param);
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+
+	wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: driver param='%s'", param);
 	if (param == NULL)
 		return 0;
 
 #ifdef CONFIG_P2P
 	if (os_strstr(param, "use_p2p_group_interface=1")) {
-		struct i802_bss *bss = priv;
-		struct wpa_driver_nl80211_data *drv = bss->drv;
-
-		wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group "
-			   "interface");
+		wpa_msg(drv->ctx, MSG_DEBUG, "nl80211: Use separate P2P group "
+			"interface");
 		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
 		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
 	}
@@ -7293,9 +7299,9 @@ static void nl80211_global_deinit(void *priv)
 	if (global == NULL)
 		return;
 	if (!dl_list_empty(&global->interfaces)) {
-		wpa_printf(MSG_ERROR, "nl80211: %u interface(s) remain at "
-			   "nl80211_global_deinit",
-			   dl_list_len(&global->interfaces));
+		wpa_msg(NULL, MSG_ERROR, "nl80211: %u interface(s) remain at "
+			"nl80211_global_deinit",
+			dl_list_len(&global->interfaces));
 	}
 	if (global->netlink)
 		netlink_deinit(global->netlink);
@@ -7338,7 +7344,8 @@ static int nl80211_pmkid(struct i802_bss *bss, int cmd, const u8 *bssid,
 static int nl80211_add_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
 {
 	struct i802_bss *bss = priv;
-	wpa_printf(MSG_DEBUG, "nl80211: Add PMKID for " MACSTR, MAC2STR(bssid));
+	wpa_msg(bss->drv->ctx, MSG_DEBUG, "nl80211: Add PMKID for " MACSTR,
+		MAC2STR(bssid));
 	return nl80211_pmkid(bss, NL80211_CMD_SET_PMKSA, bssid, pmkid);
 }
 
@@ -7346,8 +7353,8 @@ static int nl80211_add_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
 static int nl80211_remove_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
 {
 	struct i802_bss *bss = priv;
-	wpa_printf(MSG_DEBUG, "nl80211: Delete PMKID for " MACSTR,
-		   MAC2STR(bssid));
+	wpa_msg(bss->drv->ctx, MSG_DEBUG, "nl80211: Delete PMKID for " MACSTR,
+		MAC2STR(bssid));
 	return nl80211_pmkid(bss, NL80211_CMD_DEL_PMKSA, bssid, pmkid);
 }
 
@@ -7355,7 +7362,7 @@ static int nl80211_remove_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
 static int nl80211_flush_pmkid(void *priv)
 {
 	struct i802_bss *bss = priv;
-	wpa_printf(MSG_DEBUG, "nl80211: Flush PMKIDs");
+	wpa_msg(bss->drv->ctx, MSG_DEBUG, "nl80211: Flush PMKIDs");
 	return nl80211_pmkid(bss, NL80211_CMD_FLUSH_PMKSA, NULL, NULL);
 }
 
-- 
1.7.3.4




More information about the Hostap mailing list