WPS: Update MAC address on address changes

The WPS component keeps a copy of the network interface MAC address.
When MAC address is changed the WPS copy was not updated so WPS M1
message contained the old address. Some devices check this field
and fail connection attempts.

Update the WPS MAC address on interface MAC address changes.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sony.com>
This commit is contained in:
Mikael Kanstrup 2019-08-16 08:50:54 +02:00 committed by Jouni Malinen
parent 39042d7f7c
commit 8788a314d7
3 changed files with 16 additions and 0 deletions

View File

@ -4371,6 +4371,7 @@ int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
} }
wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr); wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
wpas_wps_update_mac_addr(wpa_s);
return 0; return 0;
} }

View File

@ -2233,6 +2233,16 @@ void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
} }
void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s)
{
struct wps_context *wps;
wps = wpa_s->wps;
if (wps)
os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
}
#ifdef CONFIG_WPS_NFC #ifdef CONFIG_WPS_NFC
#ifdef CONFIG_WPS_ER #ifdef CONFIG_WPS_ER

View File

@ -62,6 +62,7 @@ struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
int ndef, const char *uuid); int ndef, const char *uuid);
int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s); int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
void wpas_wps_update_config(struct wpa_supplicant *wpa_s); void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s);
struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s, struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
int ndef, const char *id_str); int ndef, const char *id_str);
struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef); struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef);
@ -154,6 +155,10 @@ wpas_wps_reenable_networks_pending(struct wpa_supplicant *wpa_s)
return 0; return 0;
} }
static inline void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s)
{
}
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
#endif /* WPS_SUPPLICANT_H */ #endif /* WPS_SUPPLICANT_H */