[PATCH 1/6] ctrl_iface: BSS command return FAIL on failure

Jonathan Afek jonathan at wizery.com
Tue Jun 7 06:42:38 PDT 2016


The BSS supplicant command returns a 0 len reply on a failure
when the BSS isn't in the DB or if the command has invalid params.
This patch make the function wpa_supplicant_ctrl_iface_bss()
return -1 on failures instead of 0 and therefore the BSS command
will return FAIL on failures.
This is important since when using udp control interfaces
sending a 0 len reply does not send a reply at all and the
control interface can wait forever (or until a timeout is reached)
for a reply.

Signed-off-by: Jonathan Afek <jonathanx.afek at intel.com>
---
 wpa_supplicant/ctrl_iface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index e75f1ae..2ff47cb 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -4448,7 +4448,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
 			if ((ctmp = os_strchr(cmd + 6, '-')) == NULL) {
 				wpa_printf(MSG_INFO, "Wrong BSS range "
 					   "format");
-				return 0;
+				return -1;
 			}
 
 			if (*(cmd + 6) == '-')
@@ -4530,7 +4530,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
 	}
 
 	if (bss == NULL)
-		return 0;
+		return -1;
 
 	if (bsslast == NULL)
 		bsslast = bss;
-- 
1.9.1




More information about the Hostap mailing list