The wcn36xx driver in Xenial/linux-snapdragon had an ability to autogerenate its MAC address upon boot, or read it from a file (/lib/firmware/wlan/macaddr0). The linux-snapdragon kernel in Bionic doesn't have this ability.
While by itself it's not a bug (Xenial used a QCOM provided custom driver, while Bionic uses the upstream wcn36xx driver) and can be easility workarounded by specifying the hw address in /etc/network/interfaces, or set via ifconfig on the commandline, it turned out to be a real problem on ubuntu core:
1) upon boot, with now MAC address assigned, the wcn36xx assigns itself the empty value "00:00:00:00:00" and that prevents the network interface to work at all, until a valid address is set
2) the ubuntu core installed doesn't have any knowledge about this, it tris to 'up' the interface and upon failure, it simply marks it as 'not working'
On top of that, ubuntu core ships a small script in initramfs that generates the /lib/firmware/wlan/macaddr0 file starting from the android boot serial, effectively generating a unique MAC address per board: clearly, without driver support for this feature, the ubuntu core efforts fall flat.
Fix:
Import back from Xenial the MAC generation mechanism: the pseudo random generation and parsing of /lib/firmware/wlan/macaddr0 - see the attached patch.
How to test:
Unpon boot, if no /lib/firmware/wlan/macaddr0 is present, the kernel will print:
[ 10.612701] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: Direct firmware load for wlan/macaddr0 failed with error -2
[ 10.612713] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: Failed (-2) to read macaddressfile wlan/macaddr0, using a random address instead
Low - the patch is small and the code is wrapped in a Kconfig option (WCN36XX_SNAPDRAGON_HACKS) that only affects the linux-snapdragon flavour, leaving the generic kernel untouched.
Impact:
The wcn36xx driver in Xenial/ linux-snapdrago n had an ability to autogerenate its MAC address upon boot, or read it from a file (/lib/firmware/ wlan/macaddr0) . The linux-snapdragon kernel in Bionic doesn't have this ability.
While by itself it's not a bug (Xenial used a QCOM provided custom driver, while Bionic uses the upstream wcn36xx driver) and can be easility workarounded by specifying the hw address in /etc/network/ interfaces, or set via ifconfig on the commandline, it turned out to be a real problem on ubuntu core:
1) upon boot, with now MAC address assigned, the wcn36xx assigns itself the empty value "00:00:00:00:00" and that prevents the network interface to work at all, until a valid address is set
2) the ubuntu core installed doesn't have any knowledge about this, it tris to 'up' the interface and upon failure, it simply marks it as 'not working'
On top of that, ubuntu core ships a small script in initramfs that generates the /lib/firmware/ wlan/macaddr0 file starting from the android boot serial, effectively generating a unique MAC address per board: clearly, without driver support for this feature, the ubuntu core efforts fall flat.
Fix:
Import back from Xenial the MAC generation mechanism: the pseudo random generation and parsing of /lib/firmware/ wlan/macaddr0 - see the attached patch.
How to test:
Unpon boot, if no /lib/firmware/ wlan/macaddr0 is present, the kernel will print:
[ 10.612701] wcn36xx a204000. wcnss:smd- edge:wcnss: wifi: Direct firmware load for wlan/macaddr0 failed with error -2 wcnss:smd- edge:wcnss: wifi: Failed (-2) to read macaddressfile wlan/macaddr0, using a random address instead
[ 10.612713] wcn36xx a204000.
ubuntu@ dragon410c: ~$ ifconfig wlan0 BROADCAST, MULTICAST> mtu 1500
wlan0: flags=4098<
ether 00:0a:f5:d5:54:d7 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
else, if /lib/firmware/ wlan/macaddr0 is present, its content will be used to generate wlan0 MAC address:
ubuntu@ dragon410c: ~$ cat /lib/firmware/ wlan/macaddr0
fe:1a:19:77:d9:88
ubuntu@ dragon410c: ~$ ifconfig wlan0 BROADCAST, MULTICAST> mtu 1500
wlan0: flags=4098<
ether fe:1a:19:77:d9:88 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Regression potential:
Low - the patch is small and the code is wrapped in a Kconfig option (WCN36XX_ SNAPDRAGON_ HACKS) that only affects the linux-snapdragon flavour, leaving the generic kernel untouched.
---