From c06bdd6cfe924a804a2db0c0d8693478e927a015 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 6 Jul 2022 22:19:55 +0200 Subject: [PATCH] gluon-core: only restore WAN proto on upgrade (#2576) Only restore the netifd proto for the WAN bridge in case the upgrade is done from an older Gluon version. For DSL targets, OpenWrt defaults the WAN proto to pppoe, while Gluon uses the Ethernet ports for WAN. When unconditionally preserving the WAN proto, pppoe is carried over to Gluon's network config. Signed-off-by: David Bauer --- .../gluon-core/luasrc/lib/gluon/upgrade/110-network | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/110-network b/package/gluon-core/luasrc/lib/gluon/upgrade/110-network index ac084e6a..be82ec5c 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/110-network +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/110-network @@ -1,6 +1,8 @@ #!/usr/bin/lua local uci = require('simple-uci').cursor() + +local sysconfig = require 'gluon.sysconfig' local util = require 'gluon.util' local wan = uci:get_all('network_gluon-old', 'wan') or {} @@ -13,8 +15,15 @@ uci:section('network', 'interface', 'loopback', { netmask = '255.0.0.0', }) +local wan_proto = 'dhcp' + +if sysconfig.gluon_version and wan.proto ~= nil then + -- Only restore WAN proto in case this is an upgrade + wan_proto = wan.proto +end + uci:section('network', 'interface', 'wan', { - proto = wan.proto or 'dhcp', + proto = wan_proto, ipaddr = wan.ipaddr, netmask = wan.netmask, gateway = wan.gateway,