From 8645bb6f4abd0fd7ef72b54204fca9467bb36d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Tue, 17 May 2022 14:19:08 +0200 Subject: [PATCH] private-ap: move network into upgrade --- .../lib/gluon/upgrade/325-gluon-private-ap | 19 +++++++++++++++++++ .../config-mode/model/admin/privateap.lua | 17 ++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap b/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap index 1acc1061..2e0b61dd 100755 --- a/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap +++ b/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap @@ -15,4 +15,23 @@ wireless.foreach_radio(uci, function(radio) uci:set('wireless', name, 'ifname', suffix and 'ap' .. suffix) end) +uci:set('network', 'globals', 'ula_prefix', uci:get('network_gluon-old', 'globals', 'ula_prefix')) + +uci:section('network', 'interface', 'ap', { + type = 'bridge', + ifname = {}, + proto = 'static', + ipaddr = uci:get('network_gluon-old', 'ap', 'ipaddr') or '192.168.178.1/24', + ip6assign = '64', +}) + +uci:section('dhcp', 'dhcp', 'ap', { + interface = 'ap', + start = '100', + limit = '150', + leasetime = '12h', +}) + +uci:save('network') +uci:save('dhcp') uci:save('wireless') diff --git a/package/gluon-web-private-ap/luasrc/lib/gluon/config-mode/model/admin/privateap.lua b/package/gluon-web-private-ap/luasrc/lib/gluon/config-mode/model/admin/privateap.lua index daa4f50d..67dfee1d 100644 --- a/package/gluon-web-private-ap/luasrc/lib/gluon/config-mode/model/admin/privateap.lua +++ b/package/gluon-web-private-ap/luasrc/lib/gluon/config-mode/model/admin/privateap.lua @@ -46,7 +46,7 @@ mfp.default = uci:get('wireless', primary_iface, 'ieee80211w') or "0" local subnet4 = s:option(Value, "subnet4", translate("Subnet IPv4 (NAT)"), translate("IPv4 CIDR")) subnet4:depends(enabled, true) subnet4.datatype = "maxlength(32)" -subnet4.default = uci:get('network', 'ap', 'ipaddr') or '192.168.178.1/24' +subnet4.default = uci:get('network', 'ap', 'ipaddr') local subnet6 = s:option(Value, "subnet6", translate("ULA IPv6"), translate("IPv6 CIDR or 'auto'")) subnet6:depends(enabled, true) @@ -59,20 +59,7 @@ subnet6.default = uci:get('network', 'globals', 'ula_prefix') function f:write() uci:set('network', 'globals', 'ula_prefix', subnet6.data) - uci:section('network', 'interface', 'ap', { - type = 'bridge', - ifname = {}, - proto = 'static', - ipaddr = subnet4.data, - ip6assign = '64', - }) - - uci:section('dhcp', 'dhcp', 'ap', { - interface = 'ap', - start = '100', - limit = '150', - leasetime = '12h', - }) + uci:set('network', 'interface', 'ap', subnet4.data) wireless.foreach_radio(uci, function(radio, index) local radio_name = radio['.name']