aboutsummaryrefslogtreecommitdiffstats
path: root/src/l2_packet
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-24 10:43:35 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-26 11:20:57 (GMT)
commita193231dfb0ea5e7a5cf66e7e314a6d845768241 (patch)
tree74b25eb580732d91f678c93952eb2958efa12b44 /src/l2_packet
parentcad9b88be2ad3c0eaa52bdda2435a0b719a60915 (diff)
downloadhostap-a193231dfb0ea5e7a5cf66e7e314a6d845768241.zip
hostap-a193231dfb0ea5e7a5cf66e7e314a6d845768241.tar.gz
hostap-a193231dfb0ea5e7a5cf66e7e314a6d845768241.tar.bz2
Clean up debug prints to use wpa_printf()
This converts most of the remaining perror() and printf() calls from hostapd and wpa_supplicant to use wpa_printf(). Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/l2_packet')
-rw-r--r--src/l2_packet/l2_packet_pcap.c11
-rw-r--r--src/l2_packet/l2_packet_privsep.c17
2 files changed, 16 insertions, 12 deletions
diff --git a/src/l2_packet/l2_packet_pcap.c b/src/l2_packet/l2_packet_pcap.c
index f064172..bb4f4a3 100644
--- a/src/l2_packet/l2_packet_pcap.c
+++ b/src/l2_packet/l2_packet_pcap.c
@@ -54,15 +54,16 @@ static int l2_packet_init_libdnet(struct l2_packet_data *l2)
l2->eth = eth_open(l2->ifname);
if (!l2->eth) {
- printf("Failed to open interface '%s'.\n", l2->ifname);
- perror("eth_open");
+ wpa_printf(MSG_ERROR,
+ "Failed to open interface '%s' - eth_open: %s",
+ l2->ifname, strerror(errno));
return -1;
}
if (eth_get(l2->eth, &own_addr) < 0) {
- printf("Failed to get own hw address from interface '%s'.\n",
- l2->ifname);
- perror("eth_get");
+ wpa_printf(MSG_ERROR,
+ "Failed to get own hw address from interface '%s' - eth_get: %s",
+ l2->ifname, strerror(errno));
eth_close(l2->eth);
l2->eth = NULL;
return -1;
diff --git a/src/l2_packet/l2_packet_privsep.c b/src/l2_packet/l2_packet_privsep.c
index 8b95247..76dcccc 100644
--- a/src/l2_packet/l2_packet_privsep.c
+++ b/src/l2_packet/l2_packet_privsep.c
@@ -44,7 +44,7 @@ static int wpa_priv_cmd(struct l2_packet_data *l2, int cmd,
msg.msg_namelen = sizeof(l2->priv_addr);
if (sendmsg(l2->fd, &msg, 0) < 0) {
- perror("L2: sendmsg(cmd)");
+ wpa_printf(MSG_ERROR, "L2: sendmsg(cmd): %s", strerror(errno));
return -1;
}
@@ -82,7 +82,8 @@ int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
msg.msg_namelen = sizeof(l2->priv_addr);
if (sendmsg(l2->fd, &msg, 0) < 0) {
- perror("L2: sendmsg(packet_send)");
+ wpa_printf(MSG_ERROR, "L2: sendmsg(packet_send): %s",
+ strerror(errno));
return -1;
}
@@ -102,7 +103,8 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
res = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *) &from,
&fromlen);
if (res < 0) {
- perror("l2_packet_receive - recvfrom");
+ wpa_printf(MSG_ERROR, "l2_packet_receive - recvfrom: %s",
+ strerror(errno));
return;
}
if (res < ETH_ALEN) {
@@ -162,7 +164,7 @@ struct l2_packet_data * l2_packet_init(
l2->fd = socket(PF_UNIX, SOCK_DGRAM, 0);
if (l2->fd < 0) {
- perror("socket(PF_UNIX)");
+ wpa_printf(MSG_ERROR, "socket(PF_UNIX): %s", strerror(errno));
os_free(l2->own_socket_path);
l2->own_socket_path = NULL;
os_free(l2);
@@ -173,7 +175,8 @@ struct l2_packet_data * l2_packet_init(
addr.sun_family = AF_UNIX;
os_strlcpy(addr.sun_path, l2->own_socket_path, sizeof(addr.sun_path));
if (bind(l2->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- perror("l2-pkt-privsep: bind(PF_UNIX)");
+ wpa_printf(MSG_ERROR, "l2-pkt-privsep: bind(PF_UNIX): %s",
+ strerror(errno));
goto fail;
}
@@ -191,14 +194,14 @@ struct l2_packet_data * l2_packet_init(
tv.tv_usec = 0;
res = select(l2->fd + 1, &rfds, NULL, NULL, &tv);
if (res < 0 && errno != EINTR) {
- perror("select");
+ wpa_printf(MSG_ERROR, "select: %s", strerror(errno));
goto fail;
}
if (FD_ISSET(l2->fd, &rfds)) {
res = recv(l2->fd, reply, sizeof(reply), 0);
if (res < 0) {
- perror("recv");
+ wpa_printf(MSG_ERROR, "recv: %s", strerror(errno));
goto fail;
}
} else {