aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-08-09 19:15:14 (GMT)
committerJouni Malinen <j@w1.fi>2012-08-09 20:18:31 (GMT)
commitb22ecea902e74a77a26ffe753dee62159682b50b (patch)
tree032e169dcb69a5606d6ca623b4deb02454e2e5bf
parent37f8b9da1a7759186b5d70e2e6c50d400ce41ced (diff)
downloadhostap-b22ecea902e74a77a26ffe753dee62159682b50b.zip
hostap-b22ecea902e74a77a26ffe753dee62159682b50b.tar.gz
hostap-b22ecea902e74a77a26ffe753dee62159682b50b.tar.bz2
AOSP: driver_cmd
-rw-r--r--src/drivers/driver.h13
-rw-r--r--wpa_supplicant/ctrl_iface.c17
-rw-r--r--wpa_supplicant/driver_i.h10
3 files changed, 39 insertions, 1 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 428c4e5..beb843a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2381,7 +2381,18 @@ struct wpa_driver_ops {
* DEPRECATED - use set_ap() instead
*/
int (*set_authmode)(void *priv, int authmode);
-
+#ifdef ANDROID
+ /**
+ * driver_cmd - execute driver-specific command
+ * @priv: private driver interface data
+ * @cmd: command to execute
+ * @buf: return buffer
+ * @buf_len: buffer length
+ *
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
+#endif
/**
* set_rekey_info - Set rekey information
* @priv: Private driver interface data
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0f2c18e..77b8535 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3527,6 +3527,18 @@ static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
return ret;
}
+#ifdef ANDROID
+static int wpa_supplicant_driver_cmd(struct wpa_supplicant *wpa_s, char *cmd,
+ char *buf, size_t buflen)
+{
+ int ret;
+
+ ret = wpa_drv_driver_cmd(wpa_s, cmd, buf, buflen);
+ if (ret == 0)
+ ret = sprintf(buf, "%s\n", "OK");
+ return ret;
+}
+#endif
char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
char *buf, size_t *resp_len)
@@ -3950,6 +3962,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strncmp(buf, "SIGNAL_POLL", 11) == 0) {
reply_len = wpa_supplicant_signal_poll(wpa_s, reply,
reply_size);
+#ifdef ANDROID
+ } else if (os_strncmp(buf, "DRIVER ", 7) == 0) {
+ reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply,
+ reply_size);
+#endif
} else if (os_strcmp(buf, "REAUTHENTICATE") == 0) {
eapol_sm_request_reauth(wpa_s->eapol);
} else {
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index d8567b6..592408e 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -648,6 +648,16 @@ static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
}
+#ifdef ANDROID
+static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
+ char *cmd, char *buf, size_t buf_len)
+{
+ if (!wpa_s->driver->driver_cmd)
+ return -1;
+ return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
+}
+#endif
+
static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
const u8 *kek, const u8 *kck,
const u8 *replay_ctr)