[PATCH] Return with error when trying to set invalid WEP key length

Jouni Malinen j at w1.fi
Tue Sep 20 05:37:04 PDT 2016

On Tue, Sep 20, 2016 at 05:02:32PM +0530, Saurav Babu wrote:
> While trying to set WEP key an invalid key length can be set, but
> set command returns "OK". User is unable to know about the invalid WEP
> key length. This patch returns "FAIL" so that user can correct WEP key.

I think this no-rejection was done by design to avoid issues in starting
wpa_supplicant in some cases. See the commit message that added this for
more details:

> diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
> @@ -1563,6 +1563,7 @@ static int wpa_config_parse_wep_key(u8 *key, size_t *len, int line,
>  		wpa_printf(MSG_ERROR, "Line %d: Invalid WEP key length %u - "
>  			   "this network block will be ignored",
>  			   line, (unsigned int) *len);
> +		return -1;
>  	}

Taken into account that earlier commit message, I don't think I want to
do this for configuration file parsing. I would be fine with a change
that makes the SET_NETWORK command return FAIL with an invalid WEP key
length, but this would still need to allow wpa_supplicant to start with
an configuration file that uses invalid WEP key length to maintain the
workaround for issues on some devices.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list