Add SET command for global control interface

This allows global parameters to be set through the global control
interface without having to use IFNAME prefix. For now, this covers
only the wifi_display parameter.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-08-25 20:35:19 +03:00
parent c548fb27c8
commit 1b9b31c153

View file

@ -5989,6 +5989,28 @@ static char * wpas_global_ctrl_iface_redir(struct wpa_global *global,
} }
static int wpas_global_ctrl_iface_set(struct wpa_global *global, char *cmd)
{
char *value;
value = os_strchr(cmd, ' ');
if (value == NULL)
return -1;
*value++ = '\0';
wpa_printf(MSG_DEBUG, "GLOBAL_CTRL_IFACE SET '%s'='%s'", cmd, value);
#ifdef CONFIG_WIFI_DISPLAY
if (os_strcasecmp(cmd, "wifi_display") == 0) {
wifi_display_enable(global, !!atoi(value));
return 0;
}
#endif /* CONFIG_WIFI_DISPLAY */
return -1;
}
char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global, char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
char *buf, size_t *resp_len) char *buf, size_t *resp_len)
{ {
@ -6046,6 +6068,9 @@ char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
wpas_notify_suspend(global); wpas_notify_suspend(global);
} else if (os_strcmp(buf, "RESUME") == 0) { } else if (os_strcmp(buf, "RESUME") == 0) {
wpas_notify_resume(global); wpas_notify_resume(global);
} else if (os_strncmp(buf, "SET ", 4) == 0) {
if (wpas_global_ctrl_iface_set(global, buf + 4))
reply_len = -1;
} else { } else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16); os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16; reply_len = 16;