[PATCH] add set_country for the privsep driver
Daniel Mierswa
impulze
Wed Feb 11 21:47:27 PST 2009
---
src/common/privsep_commands.h | 1 +
src/drivers/driver_privsep.c | 11 ++++++++++-
wpa_supplicant/wpa_priv.c | 13 +++++++++++++
3 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/src/common/privsep_commands.h b/src/common/privsep_commands.h
index f8f9c1b..81b7f54 100644
--- a/src/common/privsep_commands.h
+++ b/src/common/privsep_commands.h
@@ -31,6 +31,7 @@ enum privsep_cmd {
PRIVSEP_CMD_L2_NOTIFY_AUTH_START,
PRIVSEP_CMD_L2_SEND,
PRIVSEP_CMD_SET_MODE,
+ PRIVSEP_CMD_SET_COUNTRY,
};
struct privsep_cmd_associate
diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c
index 9156dfb..c6b7857 100644
--- a/src/drivers/driver_privsep.c
+++ b/src/drivers/driver_privsep.c
@@ -756,6 +756,15 @@ static int wpa_driver_privsep_set_mode(void *priv, int mode)
}
+static int wpa_driver_privsep_set_country(void *priv, const char *alpha2)
+{
+ struct wpa_driver_privsep_data *drv = priv;
+ wpa_printf(MSG_DEBUG, "%s country='%s'", __func__, alpha2);
+ return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_COUNTRY, alpha2,
+ os_strlen(alpha2), NULL, NULL);
+}
+
+
struct wpa_driver_ops wpa_driver_privsep_ops = {
"privsep",
"wpa_supplicant privilege separated driver",
@@ -796,7 +805,7 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
wpa_driver_privsep_get_scan_results2,
NULL /* set_probe_req_ie */,
wpa_driver_privsep_set_mode,
- NULL /* set_country */,
+ wpa_driver_privsep_set_country,
NULL /* global_init */,
NULL /* global_deinit */,
NULL /* init2 */,
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index 8ad20ca..91c3916 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -574,6 +574,16 @@ static void wpa_priv_cmd_set_mode(struct wpa_priv_interface *iface,
iface->driver->set_mode(iface->drv_priv, *((int *) buf));
}
+static void wpa_priv_cmd_set_country(struct wpa_priv_interface *iface,
+ void *buf, size_t len)
+{
+ if (iface->drv_priv == NULL || iface->driver->set_country == NULL ||
+ !len)
+ return;
+
+ iface->driver->set_country(iface->drv_priv, (char *)buf);
+}
+
static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx)
{
@@ -649,6 +659,9 @@ static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx)
case PRIVSEP_CMD_SET_MODE:
wpa_priv_cmd_set_mode(iface, cmd_buf, cmd_len);
break;
+ case PRIVSEP_CMD_SET_COUNTRY:
+ wpa_priv_cmd_set_country(iface, cmd_buf, cmd_len);
+ break;
}
}
--
1.6.1.2
--------------060807040103050102040104--
More information about the Hostap
mailing list