diff mbox

[1/2] ctrl_iface: BSS command return FAIL on no data

Message ID 1465412498-32289-1-git-send-email-jonathan@wizery.com
State Changes Requested
Headers show

Commit Message

Jonathan Afek June 8, 2016, 7:01 p.m. UTC
The BSS supplicant command returns a 0 len reply when failing to
pasrse some information for a BSS.
This patch make the function wpa_supplicant_ctrl_iface_bss()
return -1 on such cases instead of 0 and therefore the BSS command
will return FAIL.
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@intel.com>
---
 wpa_supplicant/ctrl_iface.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jouni Malinen June 12, 2016, 9:52 p.m. UTC | #1
On Wed, Jun 08, 2016 at 10:01:37PM +0300, Jonathan Afek wrote:
> The BSS supplicant command returns a 0 len reply when failing to
> pasrse some information for a BSS.
> This patch make the function wpa_supplicant_ctrl_iface_bss()
> return -1 on such cases instead of 0 and therefore the BSS command
> will return FAIL.
> 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.

I guess this could be more likely fine than the 1/6 from the previous
set. That said, I'm dropping these two patches for now until we figure
out what to do with the UDP ctrl_iface backend and zero-length
responses. That really needs to work for other commands anyway..
diff mbox

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 2ff47cb..401cd61 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -4560,6 +4560,8 @@  static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
 		bss = dl_list_entry(next, struct wpa_bss, list_id);
 	} while (bss && len);
 
+	if (0 == ret)
+		return -1;
 	return ret;
 }