Can ESP-IDF use a randomised MAC address?

andyn_ff
Posts: 18
Joined: Mon Jun 10, 2019 4:34 pm

Can ESP-IDF use a randomised MAC address?

Postby andyn_ff » Wed Sep 15, 2021 4:48 pm

Hi,

I see that a base MAC address is burned into the efuse block by Espressif, and the MAC addresses for each interface are derived from the base MAC address. It is possible to customise the base MAC address by setting your own settings to the efuse block.

However, many devices now randomise the MAC address to increase privacy and prevent tracking. Is this possible to achieve with ESP-IDF? I don't see any API to randomise the MAC address. I could generate a random MAC address, but then I don't see any API to pass a MAC address to the network stack, only to burn to the efuse block.

Thanks for your advice in advance,
Andy


andyn_ff
Posts: 18
Joined: Mon Jun 10, 2019 4:34 pm

Re: Can ESP-IDF use a randomised MAC address?

Postby andyn_ff » Thu Sep 16, 2021 8:01 am

OK, looking at that example, I think I understand that:
  • I can set the base mac address by calling esp_base_mac_addr_set(my_chosen_mac) before the network stack is initialised, and this will be used for the session
  • The base mac address I pass in with esp_base_mac_addr_set() is in RAM and won't affect future sessions (after a power cycle etc)
  • There is no option to set the ESP-IDF code to generate a random MAC address each time, but I can generate it myself in user code.
Is that correct?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Can ESP-IDF use a randomised MAC address?

Postby WiFive » Thu Sep 16, 2021 10:55 pm

Yes, just make sure you are setting the bit for locally administrated address

Who is online

Users browsing this forum: Bing [Bot], RAJPUS3 and 131 guests