diff options
author | Findlay Feng <i@fengch.me> | 2024-02-27 15:30:05 +0800 |
---|---|---|
committer | 冯诚 <fengcheng@lidig.com> | 2024-03-29 21:43:33 +0800 |
commit | f48c8e59868bd995d8ea0f76e6cf26d2a1c6eb11 (patch) | |
tree | d3f8ef236253c06b6f472098ddb24c14155d3e7b /protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol | |
parent | bd2b2ec3402d5b28446815c872703b6763e00732 (diff) |
luci-proto-bonding: Modify ipaddr as optional
Signed-off-by: Findlay Feng <i@fengch.me>
Diffstat (limited to 'protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol')
-rw-r--r-- | protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js b/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js index 4c774290f0..5309931a2a 100644 --- a/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js +++ b/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js @@ -42,8 +42,11 @@ function getSelectableSlaves(section_id) { }); } -function validateEmpty(section, value) { - if (value) { +function validate_netmask_empty(section, value) { + var opt = this.map.lookupOption('ipaddr', section); + var ipaddr = opt[0].formvalue(section); + + if (!ipaddr || value) { return true; } else { @@ -164,13 +167,15 @@ return network.registerProtocol('bonding', { _('IPv4 address'), _('The local IPv4 address')); o.datatype = 'ip4addr'; + o.optional = true; o.rmempty = false; o = s.taboption('general', form.Value, 'netmask', _('IPv4 netmask'), _('The local IPv4 netmask')); o.datatype = 'ip4addr'; - o.validate = validateEmpty; + o.optional = true; + o.validate = validate_netmask_empty; o.rmempty = false; o.value("255.255.255.0"); o.value("255.255.0.0"); @@ -196,7 +201,7 @@ return network.registerProtocol('bonding', { }; o.validate = updatePrimaries; o.rmempty = false; - + o = s.taboption('advanced', form.ListValue, 'bonding_policy', _('Bonding Policy'), _('Specifies the mode to be used for this bonding interface')); |