aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hostapd_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-10-31 15:07:31 (GMT)
committerJouni Malinen <j@w1.fi>2010-10-31 15:07:31 (GMT)
commitacec8d320384c636e6d3b89de8e628fded1bf6c9 (patch)
treefca834c23b43af407267f87e6446a8ac8cceba69 /hostapd/hostapd_cli.c
parentae6e1bee67231b1c0bb69b6742ac99eba4e1dd14 (diff)
downloadhostap-acec8d320384c636e6d3b89de8e628fded1bf6c9.zip
hostap-acec8d320384c636e6d3b89de8e628fded1bf6c9.tar.gz
hostap-acec8d320384c636e6d3b89de8e628fded1bf6c9.tar.bz2
Add ctrl_iface command 'GET version'
This can be used to fetch the wpa_supplicant/hostapd version string.
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r--hostapd/hostapd_cli.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 3fdaa15..7cc84bb 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -670,6 +670,26 @@ static int hostapd_cli_cmd_set(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
+static int hostapd_cli_cmd_get(struct wpa_ctrl *ctrl, int argc, char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ if (argc != 1) {
+ printf("Invalid GET command: needs one argument (variable "
+ "name)\n");
+ return -1;
+ }
+
+ res = os_snprintf(cmd, sizeof(cmd), "GET %s", argv[0]);
+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+ printf("Too long GET command.\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
+
+
struct hostapd_cli_cmd {
const char *cmd;
int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]);
@@ -703,6 +723,7 @@ static struct hostapd_cli_cmd hostapd_cli_commands[] = {
{ "license", hostapd_cli_cmd_license },
{ "quit", hostapd_cli_cmd_quit },
{ "set", hostapd_cli_cmd_set },
+ { "get", hostapd_cli_cmd_get },
{ NULL, NULL }
};
@@ -717,6 +738,11 @@ static void wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[])
while (cmd->cmd) {
if (strncasecmp(cmd->cmd, argv[0], strlen(argv[0])) == 0) {
match = cmd;
+ if (os_strcasecmp(cmd->cmd, argv[0]) == 0) {
+ /* we have an exact match */
+ count = 1;
+ break;
+ }
count++;
}
cmd++;