problems setting wpa keys

Dan Williams dcbw at redhat.com
Tue Sep 18 10:29:47 EDT 2007


On Tue, 2007-09-18 at 14:45 +0200, Marc Pignat wrote:
> Hello all!
> 
> I've got a problem when the driver sets the wpa keys. When both
> unicast and multicast keys are set at once, only the unicast key is set.
> As soon as there is a multicast packet, the firmware sends a
> "MACREG_INT_CODE_MIC_ERR_MULTICAST" event and disconnects.

Interesting; what version of wpa_supplicant are you using?

dan

> I'm working with the marvell 8385 chip on the SDIO interface, and the firmware release 5.0.11p0.
> The code base is the latest libertas-2.6.git#libertas.
> 
> For my investigation, I changed the code to read back the keys (see patch1 below).
> 
> setting keys (in this example, tkip for mcast and ccmp for ucast, but also tested in tkip/tkip and ccmp/ccmp):
> libertas host: EXEC_NEXT_CMD: sending command 0x005e
> libertas host: DNLD_CMD: command 0x005e, size 98, jiffies 822365
> libertas DNLD_CMD: 5e 00 62 00 83 00 00 00 01 00 00 01 26 00 02 00 
> libertas DNLD_CMD: 06 00 10 00 de 38 cc 50 65 62 d0 44 60 b7 ef ac 
> libertas DNLD_CMD: b1 07 60 75 00 00 00 00 00 00 00 00 00 00 00 00 
> libertas DNLD_CMD: 00 00 00 00 00 00 00 01 26 00 01 00 05 00 20 00 
> libertas DNLD_CMD: 58 b0 79 67 a1 61 a4 32 b8 d6 64 77 46 e4 d8 1a 
> libertas DNLD_CMD: af e8 e8 ba 35 bb c7 05 2d d3 77 19 f7 b6 29 ee 
> libertas DNLD_CMD: 00 00 
> 
> read back: 
> libertas host: CMD_RESP: response 0x805e, size 98, jiffies 822422
> libertas CMD_RESP: 5e 80 62 00 83 00 00 00 01 00 00 01 26 00 02 00 
> libertas CMD_RESP: 06 00 10 00 de 38 cc 50 65 62 d0 44 60 b7 ef ac 
> libertas CMD_RESP: b1 07 60 75 00 00 00 00 00 00 00 00 00 00 00 00 
> libertas CMD_RESP: 00 00 00 00 00 00 00 01 26 00 01 00 05 00 20 00 
> libertas CMD_RESP: 58 b0 79 67 a1 61 a4 32 b8 d6 64 77 46 e4 d8 1a 
> libertas CMD_RESP: af e8 e8 ba 35 bb c7 05 2d d3 77 19 f7 b6 29 ee 
> libertas CMD_RESP: 00 00 
> 
> In the response, the keys seems good, but in fact it doesn't work, the next
> multicast packet will trigger a mic failure.
> 
> Setting the wpa keys in two CMD_802_11_KEY_MATERIAL commands solved the problem.
> (see the ugly-patch-2, below).
> 
> I think this problem is specific to this firmware (and interface?),
> is it working for the compact flash 8385?
> 
> Thanks in advance
> 
> Regards
> 
> Marc
> 
> 
> 
> 
> patch1: (only for testing) read back wpa keys 
> --- drivers/net/wireless/libertas/assoc.c.orig	2007-09-18 12:00:32.000000000 +0200
> +++ drivers/net/wireless/libertas/assoc.c	2007-09-18 12:54:22.000000000 +0200
> @@ -381,6 +381,12 @@
>  				    CMD_OPTION_WAITFORRSP,
>  				    0, assoc_req);
> 
> +	ret = libertas_prepare_and_send_command(priv,
> +				    CMD_802_11_KEY_MATERIAL,
> +				    CMD_ACT_GET,
> +				    CMD_OPTION_WAITFORRSP,
> +				    0, NULL);
> +
>  	lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
>  	return ret;
>  }
> 
> ugly-patch-2: send one wpa key at once
> --- drivers/net/wireless/libertas/assoc.c.orig	2007-09-18 12:00:32.000000000 +0200
> +++ drivers/net/wireless/libertas/assoc.c	2007-09-18 14:08:40.000000000 +0200
> @@ -372,15 +372,35 @@
>                                   struct assoc_request * assoc_req)
>  {
>  	int ret = 0;
> +	unsigned int flags = assoc_req->flags;
> 
>  	lbs_deb_enter(LBS_DEB_ASSOC);
> 
> -	ret = libertas_prepare_and_send_command(priv,
> -				    CMD_802_11_KEY_MATERIAL,
> -				    CMD_ACT_SET,
> -				    CMD_OPTION_WAITFORRSP,
> -				    0, assoc_req);
> +	if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
> +		clear_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
> +		ret = libertas_prepare_and_send_command(priv,
> +					CMD_802_11_KEY_MATERIAL,
> +					CMD_ACT_SET,
> +					CMD_OPTION_WAITFORRSP,
> +					0, assoc_req);
> +		assoc_req->flags = flags;
> +	}
> +
> +	if (ret)
> +		goto out;
> +
> +	if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) {
> +		clear_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
> +
> +		ret = libertas_prepare_and_send_command(priv,
> +					CMD_802_11_KEY_MATERIAL,
> +					CMD_ACT_SET,
> +					CMD_OPTION_WAITFORRSP,
> +					0, assoc_req);
> +		assoc_req->flags = flags;
> +	}
> 
> +out:
>  	lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
>  	return ret;
>  }
> 
> 
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev




More information about the libertas-dev mailing list