From 316e96a467cd98c93758eadddc8ea284e4939704 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 28 Dec 2021 20:47:26 +0100 Subject: [PATCH] gluon-core, gluon-setup-mode: reset ifname sysconfigs on each update, introduce single_ifname Allow interface names to change on updates to handle hwconfig -> DSA and similar migrations. On devices with only a single interface, a sysconfig single_ifname is created instead of wan_ifname or lan_ifname to allow separate configuration in site.conf. --- .../luasrc/lib/gluon/upgrade/020-interfaces | 20 +++++-------------- .../luasrc/lib/gluon/upgrade/320-setup-ifname | 9 ++------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index 56799616..b56a1e26 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -1,15 +1,7 @@ #!/usr/bin/lua -local sysconfig = require 'gluon.sysconfig' - --- Are we already set up? -if sysconfig.lan_ifname or sysconfig.wan_ifname then - os.exit(0) -end - - local platform = require 'gluon.platform' -local site = require 'gluon.site' +local sysconfig = require 'gluon.sysconfig' local json = require 'jsonc' local uci = require('simple-uci').cursor() @@ -69,13 +61,11 @@ end if wan_ifname and lan_ifname then sysconfig.wan_ifname = wan_ifname sysconfig.lan_ifname = lan_ifname + sysconfig.single_ifname = nil else - local single_ifname = lan_ifname or wan_ifname - if site.single_as_lan(false) then - sysconfig.lan_ifname = single_ifname - else - sysconfig.wan_ifname = single_ifname - end + sysconfig.wan_ifname = nil + sysconfig.lan_ifname = nil + sysconfig.single_ifname = lan_ifname or wan_ifname end diff --git a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname index 53d60d1c..145d371e 100755 --- a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname @@ -3,13 +3,8 @@ local platform = require 'gluon.platform' local sysconfig = require 'gluon.sysconfig' - -if sysconfig.setup_ifname then - os.exit(0) -end - if platform.is_outdoor_device() then - sysconfig.setup_ifname = sysconfig.wan_ifname or sysconfig.lan_ifname + sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.wan_ifname else - sysconfig.setup_ifname = sysconfig.lan_ifname or sysconfig.wan_ifname + sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.lan_ifname end