diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-13 12:57:08 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-13 12:57:08 +0200 |
commit | 3734f88c3588600bb03a2a413b2f3979ff5a07cf (patch) | |
tree | 98539104e7bc9da73e0f6c8a2e20aa1eb899d25a /modules | |
parent | b384683d145edff058147564c985d10ac0ee8907 (diff) |
luci-base: fix ip6hint option dependencies and validation
Ref: https://forum.openwrt.org/t/odhcpd-make-lease-file-persistent/44118/8
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/protocol/static.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/protocol/static.js b/modules/luci-base/htdocs/luci-static/resources/protocol/static.js index f8a6d9486..8470e0a20 100644 --- a/modules/luci-base/htdocs/luci-static/resources/protocol/static.js +++ b/modules/luci-base/htdocs/luci-static/resources/protocol/static.js @@ -187,8 +187,17 @@ return network.registerProtocol('static', { o.datatype = 'max(64)'; o = s.taboption('general', form.Value, 'ip6hint', _('IPv6 assignment hint'), _('Assign prefix parts using this hexadecimal subprefix ID for this interface.')); + o.placeholder = '0'; + o.validate = function(section_id, value) { + var n = parseInt(value, 16); + + if (!/^(0x)?[0-9a-fA-F]+$/.test(value) || isNaN(n) || n >= 0xffffffff) + return _('Expecting an hexadecimal assignment hint'); + + return true; + }; for (var i = 33; i <= 64; i++) - o.depends('ip6assign', i); + o.depends('ip6assign', String(i)); o = s.taboption('general', form.DynamicList, 'ip6addr', _('IPv6 address')); o.datatype = 'ip6addr'; |