summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol
diff options
context:
space:
mode:
authorFindlay Feng <i@fengch.me>2024-02-27 15:30:05 +0800
committer冯诚 <fengcheng@lidig.com>2024-03-29 21:43:33 +0800
commitf48c8e59868bd995d8ea0f76e6cf26d2a1c6eb11 (patch)
treed3f8ef236253c06b6f472098ddb24c14155d3e7b /protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol
parentbd2b2ec3402d5b28446815c872703b6763e00732 (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.js13
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'));