aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hostapd_cli.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>2016-12-21 10:27:19 (GMT)
committerJouni Malinen <j@w1.fi>2016-12-21 10:57:54 (GMT)
commitbf4167b9d58747be34991185a28d7d85603da4e9 (patch)
treee07b24148394c7dbd2451c7691419563382a14f0 /hostapd/hostapd_cli.c
parent86adff09e9cb8162c484bbfa11285ec06d802dfc (diff)
downloadhostap-bf4167b9d58747be34991185a28d7d85603da4e9.zip
hostap-bf4167b9d58747be34991185a28d7d85603da4e9.tar.gz
hostap-bf4167b9d58747be34991185a28d7d85603da4e9.tar.bz2
hostapd_cli: Add completion for set command
Add command completion support for set command. Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r--hostapd/hostapd_cli.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index ee8114f..6d087c2 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1042,6 +1042,44 @@ static int hostapd_cli_cmd_set(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
+static char ** hostapd_complete_set(const char *str, int pos)
+{
+ int arg = get_cmd_arg_num(str, pos);
+ const char *fields[] = {
+#ifdef CONFIG_WPS_TESTING
+ "wps_version_number", "wps_testing_dummy_cred",
+ "wps_corrupt_pkhash",
+#endif /* CONFIG_WPS_TESTING */
+#ifdef CONFIG_INTERWORKING
+ "gas_frag_limit",
+#endif /* CONFIG_INTERWORKING */
+#ifdef CONFIG_TESTING_OPTIONS
+ "ext_mgmt_frame_handling", "ext_eapol_frame_io",
+#endif /* CONFIG_TESTING_OPTIONS */
+#ifdef CONFIG_MBO
+ "mbo_assoc_disallow",
+#endif /* CONFIG_MBO */
+ "deny_mac_file", "accept_mac_file",
+ };
+ int i, num_fields = ARRAY_SIZE(fields);
+
+ if (arg == 1) {
+ char **res;
+
+ res = os_calloc(num_fields + 1, sizeof(char *));
+ if (!res)
+ return NULL;
+ for (i = 0; i < num_fields; i++) {
+ res[i] = os_strdup(fields[i]);
+ if (!res[i])
+ return res;
+ }
+ return res;
+ }
+ return NULL;
+}
+
+
static int hostapd_cli_cmd_get(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
@@ -1389,7 +1427,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
"= show full hostapd_cli license" },
{ "quit", hostapd_cli_cmd_quit, NULL,
"= exit hostapd_cli" },
- { "set", hostapd_cli_cmd_set, NULL,
+ { "set", hostapd_cli_cmd_set, hostapd_complete_set,
"<name> <value> = set runtime variables" },
{ "get", hostapd_cli_cmd_get, NULL,
"<name> = get runtime info" },