summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-21 22:12:31 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-21 22:12:31 +0100
commit48e18fb8acfdc661793582e4a907b10b9e8d0d43 (patch)
tree7c193fed104dc9e904636155d48c5405ff738bbb /modules/luci-mod-network
parent7ec007f926a9c966b3297085c4c46915372ba1dc (diff)
luci-mod-network: wifi join: allow reclaiming empty wwan networks
Fixes: #3660 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/view/network/wireless.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
index 171b8f3b3..be8358d0f 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
@@ -1971,6 +1971,15 @@ return L.view.extend({
is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' || a == 'sae' })),
replace, passphrase, name, bssid, zone;
+ var nameUsed = function(name) {
+ var s = uci.get('network', name);
+ if (s != null && s['.type'] != 'interface')
+ return true;
+
+ var net = (s != null) ? network.instantiateNetwork(name) : null;
+ return (net != null && !net.isEmpty());
+ };
+
s2.render = function() {
return Promise.all([
{},
@@ -1985,13 +1994,13 @@ return L.view.extend({
name.default = 'wwan';
name.rmempty = false;
name.validate = function(section_id, value) {
- if (uci.get('network', value))
+ if (nameUsed(value))
return _('The network name is already used');
return true;
};
- for (var i = 2; uci.get('network', name.default); i++)
+ for (var i = 2; nameUsed(name.default); i++)
name.default = 'wwan%d'.format(i);
if (is_wep || is_psk) {