I was wondering about the fact that this random MAC generation happens so early in the boot. Maybe it is some sort of standard settings used before the real settings were loaded. I don't know.
Yes it is. MAC address for some devices is randomly generated like that, and then it is corrected by OpenWrt system after root is mounted (and OpenWrt can read the true MAC from where it is stored). But this should not matter, as this swapping should happen BEFORE the OpenWrt system starts up network interfaces and advertises any service like DLNA on it.
I think your issue is not MAC. At least not directly. Random MAC for network does not matter much. It only needs to be unique.
No devices care about random IPv6 either, so let's leave that too.
I think your issue is that the DLNA server is changing either its serial or its UUID code on reboot. This would cause the "new server detected" issue you say.
Because serial and UUID are used to uniquely identify the server. If these codes change, devices will think this is a new server.
By looking at the documentation, http://manpages.ubuntu.com/manpages/cosmic/en/man5/minidlna.conf.5.html
serial Set the serial number reported to clients. Defaults to MAC address od network
uuid Specify device's UPnP UUID minidlna should use. By default MAC address is used to
build uniq UUID.
it seems MiniDLNA server can generate automatically serial and UUID on boot by looking at MAC address if they are not set in the config. It seems this is failing for some reason and you get random serial and/or UUID.
Serial is a setting you can write with uci and web interface, it should be default "123456" in the OpenWrt config, so I don't think this is the issue.
UUID is NOT a setting defined in OpenWrt configuration so it's empty and will be autogenerated.
I guess this is the issue here. To workaround this you need to hack the init script that reads the UCI config and generates the minidlna config to force a set UUID.
Please edit /etc/init.d/minidlna, locate the
minidlna_cfg_addstr "$cfg" root_container '.'
line and after it add a new line:
minidlna_cfg_addstr "$cfg" uuid '019f9a56-ff60-44c0-9edc-eae88d09fa05'
Save and close the file.
You can install nano to edit files through the ssh terminal. opgk install nano
then open the file with nano /etc/init.d/minidlna
The UUID code in the line above was randomly generated by me, it is not special, you can use a UUID you created if you prefer.
Now the UUID is written in a config and will NOT change after a reboot.
Then clean the DLNA server list in your TV and devices, and reboot the OpenWrt device.
The devices should see a new DLNA server now, (using that UUID), and if you reboot again you should not have any more "new" DLNA servers.
Please report back with any results of this workaround so I can try to contribute a fix.