diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 325455791..05d6be6ff 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -3364,6 +3364,23 @@ static int hostapd_ctrl_iface_get_capability(struct hostapd_data *hapd, } +#ifdef ANDROID +static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd, + char *buf, size_t buflen) +{ + int ret; + + ret = hostapd_drv_driver_cmd(hapd, cmd, buf, buflen); + if (ret == 0) { + ret = os_snprintf(buf, buflen, "%s\n", "OK"); + if (os_snprintf_error(buflen, ret)) + ret = -1; + } + return ret; +} +#endif /* ANDROID */ + + static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, char *buf, char *reply, int reply_size, @@ -3866,6 +3883,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strcmp(buf, "PTKSA_CACHE_LIST") == 0) { reply_len = ptksa_cache_list(hapd->ptksa, reply, reply_size); #endif /* CONFIG_PASN */ +#ifdef ANDROID + } else if (os_strncmp(buf, "DRIVER ", 7) == 0) { + reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply, + reply_size); +#endif /* ANDROID */ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); reply_len = 16; diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 249e46699..eaa628ad0 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1541,6 +1541,14 @@ static int hostapd_cli_cmd_reload_wpa_psk(struct wpa_ctrl *ctrl, int argc, } +#ifdef ANDROID +static int hostapd_cli_cmd_driver(struct wpa_ctrl *ctrl, int argc, char *argv[]) +{ + return hostapd_cli_cmd(ctrl, "DRIVER", 1, argc, argv); +} +#endif /* ANDROID */ + + struct hostapd_cli_cmd { const char *cmd; int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]); @@ -1732,6 +1740,10 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { " [req_mode=] = send a Beacon report request to a station" }, { "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL, "= reload wpa_psk_file only" }, +#ifdef ANDROID + { "driver", hostapd_cli_cmd_driver, NULL, + " [] = send driver command data" }, +#endif /* ANDROID */ { NULL, NULL, NULL, NULL } }; diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index 582ab61d8..a42070116 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -393,4 +393,14 @@ hostapd_drv_set_band(struct hostapd_data *hapd, u32 band_mask) return hapd->driver->set_band(hapd->drv_priv, band_mask); } +#ifdef ANDROID +static inline int hostapd_drv_driver_cmd(struct hostapd_data *hapd, + char *cmd, char *buf, size_t buf_len) +{ + if (!hapd->driver->driver_cmd) + return -1; + return hapd->driver->driver_cmd(hapd->drv_priv, cmd, buf, buf_len); +} +#endif /* ANDROID */ + #endif /* AP_DRV_OPS */