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

Jouni Malinen j at w1.fi
Sun Jun 12 14:44:59 PDT 2016


On Tue, Jun 07, 2016 at 04:42:38PM +0300, Jonathan Afek wrote:
> 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.

It sounds fine to return FAIL on invalid params, but BSS-not-found is
not really a failure and I think the empty response for used here by
design. Changing that now could result in breaking existing users.

> 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.

Maybe the UDP control interface backend should be fixed instead?

> diff --git 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;

This looks fine..

> @@ -4530,7 +4530,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
>  	}
>  
>  	if (bss == NULL)
> -		return 0;
> +		return -1;

This could potentially break existing users that might expect an empty
response at the end of the iteration.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list