]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AOSP: driver_cmd
authorJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 19:15:14 +0000 (22:15 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 9 Aug 2012 20:18:31 +0000 (23:18 +0300)
src/drivers/driver.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/driver_i.h

index 428c4e5db046e1ff51435ebf30de772c806c6157..beb843a32de56b721dea46d1eaa153e3a0131291 100644 (file)
@@ -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
index 0f2c18ed8e4a577b92896e47fa27164160685e82..77b853577496e40afc6001d59fbefe52049de99e 100644 (file)
@@ -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 {
index d8567b6da4e8810e243e4c4620818d734bea6579..592408e4740ad46a88472cbfd9d2516dd38d852d 100644 (file)
@@ -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)