diff options
author | Jan Bětík <jan.betik@svine.su> | 2020-10-10 23:48:17 +0200 |
---|---|---|
committer | Jan Bětík <jan.betik@svine.su> | 2020-10-19 13:31:28 +0200 |
commit | 2b7fd1292f3c5055e9f5c431e411c53d3b84adf5 (patch) | |
tree | a90c941a96cb762c82795ee3fe5c47ef94fcb5fa /protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js | |
parent | 57247563d4c88208a98989253bf6b55f92bd1082 (diff) |
luci-proto-gre: improvement of LuCI interface
Better handling of Type of Service (IPv4), Traffic Class (IPv6) values
Optional value Local endpoint address is detected and pre-filled in the interface
Signed-off-by: Jan Bětík <jan.betik@svine.su>
Diffstat (limited to 'protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js')
-rw-r--r-- | protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js b/protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js index 426b5d98df..bb61805bda 100644 --- a/protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js +++ b/protocols/luci-proto-gre/htdocs/luci-static/resources/protocol/gretap.js @@ -46,6 +46,13 @@ return network.registerProtocol('gretap', { o = s.taboption('general', form.Value, 'ipaddr', _("Local IPv4 address"), _("The local IPv4 address over which the tunnel is created (optional).")); o.optional = true; o.datatype = 'ip4addr("nomask")'; + o.load = function(section_id) { + return network.getWANNetworks().then(L.bind(function(nets) { + if (nets.length) + this.placeholder = nets[0].getIPAddr(); + return form.Value.prototype.load.apply(this, [section_id]); + }, this)); + }; o = s.taboption('general', widgets.NetworkSelect, 'network', _("Network interface"), _("Logical network to which the tunnel will be added (bridged) (optional).")); o.exclude = s.section; @@ -69,11 +76,11 @@ return network.registerProtocol('gretap', { o.placeholder = 64; o.datatype = 'min(1)'; - o = s.taboption('advanced', form.Value, 'tos', _('Override TOS'), _("Specify a TOS (Type of Service). Can be either <code>inherit</code> (the outer header inherits the value of the inner header) or an hexadecimal value starting with <code>0x</code> (optional).")); + o = s.taboption('advanced', form.Value, 'tos', _("Override TOS"), _("Specify a TOS (Type of Service). Can be <code>inherit</code> (the outer header inherits the value of the inner header) or an hexadecimal value <code>00..FF</code> (optional).")); o.optional = true; o.validate = function(section_id, value) { - if (value.length > 0 && !value.match(/^0x[a-fA-F0-9]{1,2}$/) && !value.match(/^inherit$/i)) - return _('Invalid value'); + if (value.length > 0 && !value.match(/^[a-f0-9]{1,2}$/i) && !value.match(/^inherit$/i)) + return _("Invalid TOS value, expected 00..FF or inherit"); return true; }; @@ -84,6 +91,9 @@ return network.registerProtocol('gretap', { o = s.taboption('advanced', form.Flag, 'nohostroute', _("No host route"), _("Do not create host route to peer (optional).")); o.optional = true; + o = s.taboption('advanced', form.Flag, 'multicast', _("Multicast"), _("Enable support for multicast traffic (optional).")); + o.optional = true; + o = s.taboption('advanced', form.Value, 'ikey', _("Incoming key"), _("Key for incoming packets (optional).")); o.optional = true; o.datatype = 'integer'; |