[PATCH] wpa_supplicant: restore permanent mac on reassoc

Jouni Malinen j at w1.fi
Sat Oct 15 12:07:20 PDT 2016


On Tue, Oct 11, 2016 at 04:51:53PM +0200, Benjamin Richter wrote:
> With mac_addr=0 and preassoc_mac_addr=1, the permanent MAC address
> should be restored after association. Previously this did not happen
> when reassociating to the same ESS.

After association? This is modifying wpa_supplicant_associate(), i.e.,
selecting the address for the about to be started association..

> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> @@ -1691,7 +1691,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
>  			wmm_ac_save_tspecs(wpa_s);
>  			wpa_s->reassoc_same_bss = 1;
>  		}
> -	} else if (rand_style > 0) {
> +	}
> +
> +	if (rand_style > 0 && !wpa_s->reassoc_same_ess) {
>  		if (wpas_update_random_addr(wpa_s, rand_style) < 0)
>  			return;
>  		wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);

So the actual change in behavior does not show here without some
additional context.  That change here does not change the logic for
calling wpas_update_random_addr(). This is followed by:

    } else if (wpa_s->mac_addr_changed) {
	if (wpa_drv_set_mac_addr(wpa_s, NULL) < 0) {

So this call to clear the MAC address back to the permanent one could
now be called even if wpa_s->last_ssid == ssid (the condition just above
the context here). Wouldn't that break this for mac_addr == 1 and 2
cases by clearing the random MAC address for reassociation to the same
ESS cases when the previously selected random MAC address should be
maintained instead?

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list