From 9e4d8ad441fef2ed222dc61b3b6eedb093ae8c5a Mon Sep 17 00:00:00 2001 From: David Bauer <mail@david-bauer.net> Date: Wed, 13 Dec 2023 20:46:12 +0100 Subject: [PATCH] gluon-core: preserve interface MAC-address configuration (#3102) This preserves configuration of MAC-addresses for each interface in case OpenWrt sets them using netifd. This is done by preserving all device-configuration which does not define a bridge or the MAC-address of a bridge. Closes #3100 Signed-off-by: David Bauer <mail@david-bauer.net> --- .../gluon-core/luasrc/lib/gluon/upgrade/020-interfaces | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index 85a63c4e..9c155fb0 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -90,8 +90,15 @@ else sysconfig.single_ifname = lan_ifname or wan_ifname end +-- Delete all UCI device sections of type 'bridge' +-- as well as the ones starting with 'br-'. +-- Preserve all others to apply MAC address stored in UCI +uci:foreach('network', 'device',function(s) + if s.type == 'bridge' or s.name:match('^br-') then + uci:delete('network', s['.name']) + end +end) -uci:delete_all('network', 'device') uci:delete_all('network', 'interface') uci:save('network') -- GitLab