Disabling P2P-device MAC Address randomization for P2P persistent groups

Macrì Alberto amacri at tiscali.it
Fri Jan 1 22:27:05 EST 2021


Hi,

as additional information to the already posted problem, I tested the 
following settings:

p2p_device_random_mac_addr=1

p2p_device_persistent_mac_addr=dc:a6:32:01:02:03

The following call fails in driver_nl80211.c:

     if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0) < 0)

This is the log:

...

Using existing control interface directory.
ctrl_interface_group=109 (from group name 'netdev')
p2p-dev-wlan0: Restore last used MAC address.
Could not read interface p2p-dev-wlan0 flags: No such device
p2p-dev-wlan0: Failed to set random MAC address
p2p-dev-wlan0: Failed to initialize P2P random MAC address.
p2p-dev-wlan0: Failed to init P2P
Failed to add interface p2p-dev-wlan0

...

Might it be related to some driver limitation?

I tested that, by setting the following code in "driver_nl80211.c" 
before "ret = send_and_recv_msgs(drv, msg, handler, arg, NULL, NULL);" 
the address can be forced to a predefined value:

#define STATIC_MAC_ADDRESS "dc:a6:32:01:02:03"

     if (iftype == NL80211_IFTYPE_P2P_DEVICE) {
         u8 mac_addr[ETH_ALEN];
         if (hwaddr_aton2(STATIC_MAC_ADDRESS, mac_addr))
             if(nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr))
                 goto fail;
     }

Would this be an appropriate strategy (e.g., sending STATIC_MAC_ADDRESS 
by reading it from p2p_device_persistent_mac_addr)?

Thanks

Regards

Alberto


Il 29/12/2020 16:19, Macrì Alberto ha scritto:

> The current versions of the nl80211 device drivers enable MAC 
> randomization by default, so that, when wpa_supplicant creates the 
> "P2P-Device" virtual interface, a randomized MAC address is used and 
> this breaks the persistent P2P Group reuse when the "P2P-Device" 
> virtual interface is recreated. A persistent P2P-GO group works 
> correctly while wpa_supplicant is running. After restarting 
> wpa_supplicant, it creates a new "P2P-device type" interface with a 
> different (randomized) MAC address and the saved persistent group in 
> the peer device becomes no more usable for reconnection: only a new 
> persistent group can be established (through new authorization 
> process), usable until wpa_supplicant is subsequently restarted.
>
> The expected behaviour is that a reconnection to the previously saved 
> group is possible also after restarting wpa_supplicant.
>
> After experimenting a modification in wpa_supplicant so that it forces 
> a fixed MAC address during the "P2P-Device" virtual interface 
> creation, I performed some tests using an Android device as P2P Client 
> and a Linux server running the modified wpa_supplicant: in such case 
> the issue is overcome.
>
> Can someone confirm that a change has to be done in wpa_supplicant in 
> order to support such feature?
>
> Thanks
>



More information about the Hostap mailing list