diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-04-07 03:30:56 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-04-07 03:52:07 +0200 |
commit | 7fa789a13a4b834b86c32eff108819aa336446e1 (patch) | |
tree | 758e524246d520941d3c05cb418dec8a66d0c08d /modules | |
parent | 4ca87f6576272d4a4659e995bef00cf34d5746e9 (diff) |
luci-mod-network: follow-up fix for 723507231566b61750e32284b49acdae0d0162d3
add a null-check before parsing networks
loop through available networks on all interfaces except loopback
Closes #7047
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index b826ccb094..8825b5201c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -996,15 +996,19 @@ return view.extend({ for(var x of uci.get('system', 'ntp', 'server') || '') { so.value(x); } - var lan_net = this.networks.filter(function(n) { return n.getName() == 'lan' })[0]; - // If ntpd is set up, suggest our IP(v6) also - if(uci.get('system', 'ntp', 'enable_server')) { - lan_net.getIPAddrs().forEach(function(i4) { - so.value(i4.split('/')[0]); - }); - lan_net.getIP6Addrs().forEach(function(i6) { - so.value(i6.split('/')[0]); - }); + var local_nets = this.networks.filter(function(n) { return n.getName() != 'loopback' }); + if(local_nets) { + // If ntpd is set up, suggest our IP(v6) also + if(uci.get('system', 'ntp', 'enable_server')) { + local_nets.forEach(function(n){ + n.getIPAddrs().forEach(function(i4) { + so.value(i4.split('/')[0]); + }); + n.getIP6Addrs().forEach(function(i6) { + so.value(i6.split('/')[0]); + }); + }); + } } so.optional = true; so.rmempty = true; |