Add support for randomly generating a MAC address for a wifi-iface
instance by setting `macaddr` to `random`
When set to `random`, a new locally administered unicast MAC address
is generated and assigned to the iface everytime it is (re-)configured
Signed-off-by: Manas Sambhus <manas.sambhus+github@gmail.com>
PKG_NAME:=mac80211
PKG_VERSION:=5.15.58-1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/
PKG_HASH:=a3c2a2b7bbaf8943c65fd72f4e7d7ad5e205aeae28b26c835f9d8afa0f9810bf
#!/bin/sh
. /lib/netifd/netifd-wireless.sh
. /lib/netifd/hostapd.sh
+. /lib/functions/system.sh
init_wireless_driver "$@"
json_select ..
- [ -n "$macaddr" ] || {
+ if [ -z "$macaddr" ]; then
macaddr="$(mac80211_generate_mac $phy)"
macidx="$(($macidx + 1))"
- }
+ elif [ "$macaddr" = 'random' ]; then
+ macaddr="$(macaddr_random)"
+ fi
json_add_object data
json_add_string ifname "$ifname"