aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-02-07 10:30:32 +0200
committerJouni Malinen <j@w1.fi>2009-02-07 10:30:32 +0200
commit96c7c3072de6699dfbafa81c94af511abb49186a (patch)
tree34bd718e4afa39e4de5fe03430ffcb51914a50c8
parent716d543d5c1a0ee8cbec6bda6489913cdfa6dbec (diff)
downloadexternal_wpa_supplicant_8_ti-96c7c3072de6699dfbafa81c94af511abb49186a.zip
external_wpa_supplicant_8_ti-96c7c3072de6699dfbafa81c94af511abb49186a.tar.gz
external_wpa_supplicant_8_ti-96c7c3072de6699dfbafa81c94af511abb49186a.tar.bz2
Fix privsep build with CONFIG_CLIENT_MLME=y
Add wpa_supplicant_sta_free_hw_features() and wpa_supplicant_sta_rx() for driver wrappers in wpa_priv.
-rw-r--r--src/common/privsep_commands.h3
-rw-r--r--src/drivers/driver_privsep.c23
-rw-r--r--wpa_supplicant/wpa_priv.c52
3 files changed, 74 insertions, 4 deletions
diff --git a/src/common/privsep_commands.h b/src/common/privsep_commands.h
index be94fb8..f8f9c1b 100644
--- a/src/common/privsep_commands.h
+++ b/src/common/privsep_commands.h
@@ -1,6 +1,6 @@
/*
* WPA Supplicant - privilege separation commands
- * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -71,6 +71,7 @@ enum privsep_event {
PRIVSEP_EVENT_STKSTART,
PRIVSEP_EVENT_FT_RESPONSE,
PRIVSEP_EVENT_RX_EAPOL,
+ PRIVSEP_EVENT_STA_RX,
};
#endif /* PRIVSEP_COMMANDS_H */
diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c
index e329a74..9156dfb 100644
--- a/src/drivers/driver_privsep.c
+++ b/src/drivers/driver_privsep.c
@@ -1,6 +1,6 @@
/*
* WPA Supplicant - privilege separated driver interface
- * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -443,6 +443,22 @@ static void wpa_driver_privsep_event_rx_eapol(void *ctx, u8 *buf, size_t len)
}
+static void wpa_driver_privsep_event_sta_rx(void *ctx, u8 *buf, size_t len)
+{
+#ifdef CONFIG_CLIENT_MLME
+ struct ieee80211_rx_status *rx_status;
+
+ if (len < sizeof(*rx_status))
+ return;
+ rx_status = (struct ieee80211_rx_status *) buf;
+ buf += sizeof(*rx_status);
+ len -= sizeof(*rx_status);
+
+ wpa_supplicant_sta_rx(ctx, buf, len, rx_status);
+#endif /* CONFIG_CLIENT_MLME */
+}
+
+
static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
void *sock_ctx)
{
@@ -518,6 +534,11 @@ static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
case PRIVSEP_EVENT_RX_EAPOL:
wpa_driver_privsep_event_rx_eapol(drv->ctx, event_buf,
event_len);
+ break;
+ case PRIVSEP_EVENT_STA_RX:
+ wpa_driver_privsep_event_sta_rx(drv->ctx, event_buf,
+ event_len);
+ break;
}
os_free(buf);
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index 231b962..8ad20ca 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -1,6 +1,6 @@
/*
* WPA Supplicant / privileged helper program
- * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -1030,6 +1030,53 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
perror("sendmsg(wpas_socket)");
}
+
+#ifdef CONFIG_CLIENT_MLME
+void wpa_supplicant_sta_free_hw_features(struct wpa_hw_modes *hw_features,
+ size_t num_hw_features)
+{
+ size_t i;
+
+ if (hw_features == NULL)
+ return;
+
+ for (i = 0; i < num_hw_features; i++) {
+ os_free(hw_features[i].channels);
+ os_free(hw_features[i].rates);
+ }
+
+ os_free(hw_features);
+}
+
+
+void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
+ struct ieee80211_rx_status *rx_status)
+{
+ struct wpa_priv_interface *iface = ctx;
+ struct msghdr msg;
+ struct iovec io[3];
+ int event = PRIVSEP_EVENT_STA_RX;
+
+ wpa_printf(MSG_DEBUG, "STA RX from driver");
+ io[0].iov_base = &event;
+ io[0].iov_len = sizeof(event);
+ io[1].iov_base = (u8 *) rx_status;
+ io[1].iov_len = sizeof(*rx_status);
+ io[2].iov_base = (u8 *) buf;
+ io[2].iov_len = len;
+
+ os_memset(&msg, 0, sizeof(msg));
+ msg.msg_iov = io;
+ msg.msg_iovlen = 3;
+ msg.msg_name = &iface->drv_addr;
+ msg.msg_namelen = sizeof(iface->drv_addr);
+
+ if (sendmsg(iface->fd, &msg, 0) < 0)
+ perror("sendmsg(wpas_socket)");
+}
+#endif /* CONFIG_CLIENT_MLME */
+
+
static void wpa_priv_terminate(int sig, void *eloop_ctx, void *signal_ctx)
{
wpa_printf(MSG_DEBUG, "wpa_priv termination requested");
@@ -1060,7 +1107,8 @@ static void wpa_priv_fd_workaround(void)
static void usage(void)
{
printf("wpa_priv v" VERSION_STR "\n"
- "Copyright (c) 2007, Jouni Malinen <j@w1.fi> and contributors\n"
+ "Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi> and "
+ "contributors\n"
"\n"
"usage:\n"
" wpa_priv [-Bdd] [-P<pid file>] <driver:ifname> "