From d6b818efe5eac35c184bf65900fe85db3b63df19 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 15 Apr 2014 13:15:09 +0300 Subject: [PATCH] Remove SAVE_CONFIG redirect from global control interface The P2P redirection for SAVE_CONFIG issued on the global control interface was preventing wpas_global_ctrl_iface_save_config() from being reached. The global version of SAVE_CONFIG was supposed to try to save configuration files for all interface rather than just the P2P management interface, so fix this by removing the unneeded and undesired redirection. Modify the global SAVE_CONFIG handler to return FAIL if no configuration files were saved. This makes the behavior match with the per-interface SAVE_CONFIG. Signed-off-by: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index abffaaebc..377098052 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -6802,7 +6802,6 @@ static char * wpas_global_ctrl_iface_redir_p2p(struct wpa_global *global, #ifdef CONFIG_P2P static const char * cmd[] = { "LIST_NETWORKS", - "SAVE_CONFIG", "P2P_FIND", "P2P_STOP_FIND", "P2P_LISTEN", @@ -6929,7 +6928,7 @@ static int wpas_global_ctrl_iface_set(struct wpa_global *global, char *cmd) #ifndef CONFIG_NO_CONFIG_WRITE static int wpas_global_ctrl_iface_save_config(struct wpa_global *global) { - int ret = 0; + int ret = 0, saved = 0; struct wpa_supplicant *wpa_s; for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { @@ -6943,9 +6942,16 @@ static int wpas_global_ctrl_iface_save_config(struct wpa_global *global) ret = 1; } else { wpa_dbg(wpa_s, MSG_DEBUG, "CTRL_IFACE: SAVE_CONFIG - Configuration updated"); + saved++; } } + if (!saved && !ret) { + wpa_dbg(wpa_s, MSG_DEBUG, + "CTRL_IFACE: SAVE_CONFIG - No configuration files could be updated"); + ret = 1; + } + return ret; } #endif /* CONFIG_NO_CONFIG_WRITE */