summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network/htdocs/luci-static
diff options
context:
space:
mode:
authorPaul Donald <newtwen+github@gmail.com>2024-04-02 00:34:42 +0200
committerPaul Donald <newtwen+github@gmail.com>2024-04-02 01:52:07 +0200
commit723507231566b61750e32284b49acdae0d0162d3 (patch)
tree40935239e8bd4b44200c40ff8783b9e4f4994459 /modules/luci-mod-network/htdocs/luci-static
parente5f8af1753e008bb8e3742648e80ed09388c4ebb (diff)
luci-mod-network: add DHCPv6 NTP server config helper to interfaces
Appears under DHCPv6-service when set to 'server' or 'hybrid'. Option 'ntp' is serviced by odhcpd. It sends a DHCPv6 NTP Server option 56 for each 'ntp' list entry. Once uci loads the system section, it provides suggestion presets of system configured upstream NTP servers, and the LAN IP(v6) of the router which are then statically configured by the user. It would make more sense if odhcpd fetches them directly. Alas, it does not (yet). Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js24
1 files changed, 23 insertions, 1 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 fd7487b3de..b826ccb094 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
@@ -502,7 +502,8 @@ return view.extend({
s.load = function() {
return Promise.all([
network.getNetworks(),
- firewall.getZones()
+ firewall.getZones(),
+ uci.load('system')
]).then(L.bind(function(data) {
this.networks = data[0];
this.zones = data[1];
@@ -988,6 +989,27 @@ return view.extend({
so.depends('dhcpv6', 'server');
so.depends({ dhcpv6: 'hybrid', master: '0' });
+ //This is a DHCPv6 specific odhcpd setting
+ so = ss.taboption('ipv6', form.DynamicList, 'ntp', _('NTP Servers'),
+ _('DHCPv6 option 56. %s.', 'DHCPv6 option 56. RFC5908 link').format('<a href="%s" target="_blank">RFC5908</a>').format('https://www.rfc-editor.org/rfc/rfc5908#section-4'));
+ so.datatype = 'host(0)';
+ 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]);
+ });
+ }
+ so.optional = true;
+ so.rmempty = true;
+ so.depends('dhcpv6', 'server');
+ so.depends({ dhcpv6: 'hybrid', master: '0' });
so = ss.taboption('ipv6', cbiRichListValue, 'ndp', _('<abbr title="Neighbour Discovery Protocol">NDP</abbr>-Proxy'),
_('Configures the operation mode of the NDP proxy service on this interface.'));