summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/network.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/network.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/network.js39
1 files changed, 2 insertions, 37 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js
index 1f66c6ff9..19640604e 100644
--- a/modules/luci-base/htdocs/luci-static/resources/network.js
+++ b/modules/luci-base/htdocs/luci-static/resources/network.js
@@ -1253,43 +1253,8 @@ Protocol = L.Class.extend({
getNetmask: function() {
var addrs = this._ubus('ipv4-address');
- if (Array.isArray(addrs) && addrs.length) {
- switch (addrs[0].mask) {
- case 0: return '0.0.0.0';
- case 1: return '128.0.0.0';
- case 2: return '192.0.0.0';
- case 3: return '224.0.0.0';
- case 4: return '240.0.0.0';
- case 5: return '248.0.0.0';
- case 6: return '252.0.0.0';
- case 7: return '254.0.0.0';
- case 8: return '255.0.0.0';
- case 9: return '255.128.0.0';
- case 10: return '255.192.0.0';
- case 11: return '255.224.0.0';
- case 12: return '255.240.0.0';
- case 13: return '255.248.0.0';
- case 14: return '255.252.0.0';
- case 15: return '255.254.0.0';
- case 16: return '255.255.0.0';
- case 17: return '255.255.128.0';
- case 18: return '255.255.192.0';
- case 19: return '255.255.224.0';
- case 20: return '255.255.240.0';
- case 21: return '255.255.248.0';
- case 22: return '255.255.252.0';
- case 23: return '255.255.254.0';
- case 24: return '255.255.255.0';
- case 25: return '255.255.255.128';
- case 26: return '255.255.255.192';
- case 27: return '255.255.255.224';
- case 28: return '255.255.255.240';
- case 29: return '255.255.255.248';
- case 30: return '255.255.255.252';
- case 31: return '255.255.255.254';
- case 32: return '255.255.255.255';
- }
- }
+ if (Array.isArray(addrs) && addrs.length)
+ return prefixToMask(addrs[0].mask, false);
},
getGatewayAddr: function() {