]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Update MAC address on address changes
authorMikael Kanstrup <mikael.kanstrup@sony.com>
Fri, 16 Aug 2019 06:50:54 +0000 (08:50 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 9 Sep 2019 13:49:34 +0000 (16:49 +0300)
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>
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wps_supplicant.c
wpa_supplicant/wps_supplicant.h

index a15f6373d43055a1fef841a6f6859d1b2c4b03e0..709a33fa8826ac605f604739ec742887f9d6ff6e 100644 (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);
+       wpas_wps_update_mac_addr(wpa_s);
 
        return 0;
 }
index 737c4e0e339c3f901f9d56c1ae16d31b64616f87..1dd69a2cceb8ef3f78d67ca32eed70c9ca183c4c 100644 (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_ER
index 0fbc85174f9426d713066d7504d91e8b6b30e60d..c55936ceeaafe471b0686ce5fc98bc617e528cac 100644 (file)
@@ -62,6 +62,7 @@ struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
                                             int ndef, const char *uuid);
 int wpas_wps_terminate_pending(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,
                                          int ndef, const char *id_str);
 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;
 }
 
+static inline void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s)
+{
+}
+
 #endif /* CONFIG_WPS */
 
 #endif /* WPS_SUPPLICANT_H */