summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-03-29 20:08:48 +0200
committerJo-Philipp Wich <jo@mein.io>2021-03-29 22:35:10 +0200
commit935e9a3c3430db5fad1004926ddfa2e35a950be5 (patch)
tree3b7cde064ba5e2606821e0d9939464467f20c806 /modules/luci-mod-network
parent7dde01be3cc197f79bc6812a2c912c1889dbf1ee (diff)
luci-mod-network: allow disabling interface->device option migration
Introduce a `migrate` properties which selectively allows disabling the `config interface` to `config device` migration logic for single options. Use the new flag to disable migration of the "ipv6" option which has different semantics in interface and device sections. Ref: https://forum.openwrt.org/t/pppoe-disable-ipv6/92548 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js
index 544cad2c75..3df72940aa 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js
@@ -131,7 +131,7 @@ function deviceCfgValue(section_id) {
var ds = lookupDevSection(this.section, section_id, false);
return (ds ? uci.get('network', ds, this.option) : null) ||
- uci.get('network', section_id, this.option) ||
+ (this.migrate ? uci.get('network', section_id, this.option) : null) ||
this.default;
}
@@ -139,7 +139,9 @@ function deviceWrite(section_id, formvalue) {
var ds = lookupDevSection(this.section, section_id, true);
uci.set('network', ds, this.option, formvalue);
- uci.unset('network', section_id, this.option);
+
+ if (this.migrate)
+ uci.unset('network', section_id, this.option);
}
function deviceRemove(section_id) {
@@ -162,7 +164,8 @@ function deviceRemove(section_id) {
uci.unset('network', ds, this.option);
}
- uci.unset('network', section_id, this.option);
+ if (this.migrate)
+ uci.unset('network', section_id, this.option);
}
function deviceRefresh(section_id) {
@@ -364,6 +367,7 @@ return baseclass.extend({
var o = this.replaceOption(s, tabName, optionClass, optionName, optionTitle, optionDescription);
if (s.sectiontype == 'interface' && optionName != 'type' && optionName != 'vlan_filtering') {
+ o.migrate = true;
o.cfgvalue = deviceCfgValue;
o.write = deviceWrite;
o.remove = deviceRemove;
@@ -777,6 +781,7 @@ return baseclass.extend({
o.depends(simpledep);
o = this.addOption(s, gensection, form.Flag, 'ipv6', _('Enable IPv6'));
+ o.migrate = false;
o.default = o.enabled;
o.depends(simpledep);