diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-01-16 21:36:39 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-01-16 21:36:39 +0100 |
commit | 28f4a9fcedda504adac3426195749c45b8893836 (patch) | |
tree | da3259892c5495faabd641a1222c25e2c11ede14 /applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js | |
parent | aa62419e5ba92a0cdd8ceb487e9b9b819cf357d0 (diff) |
luci-app-firewall: support 'limit' and 'limit_burst' options
Also resync firewall translations.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js')
-rw-r--r-- | applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js index 9d8d8d1559..a5b27ccf30 100644 --- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js +++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js @@ -555,6 +555,42 @@ return L.view.extend({ return true; }; + o = s.taboption('advanced', form.Value, 'limit', _('Limit matching'), + _('Limits traffic matching to the specified rate.')); + o.modalonly = true; + o.rmempty = true; + o.placeholder = _('unlimited'); + o.value('10/second'); + o.value('60/minute'); + o.value('3/hour'); + o.value('500/day'); + o.validate = function(section_id, value) { + if (value == '') + return true; + + var m = String(value).toLowerCase().match(/^(?:0x[0-9a-f]{1,8}|[0-9]{1,10})\/([a-z]+)$/), + u = ['second', 'minute', 'hour', 'day'], + i = 0; + + if (m) + for (i = 0; i < u.length; i++) + if (u[i].indexOf(m[1]) == 0) + break; + + if (!m || i >= u.length) + return _('Invalid limit value'); + + return true; + }; + + o = s.taboption('advanced', form.Value, 'limit_burst', _('Limit burst'), + _('Maximum initial number of packets to match: this number gets recharged by one every time the limit specified above is not reached, up to this number.')); + o.modalonly = true; + o.rmempty = true; + o.placeholder = '5'; + o.datatype = 'uinteger'; + o.depends({ limit: null, '!reverse': true }); + o = s.taboption('advanced', form.Value, 'extra', _('Extra arguments'), _('Passes additional arguments to iptables. Use with care!')); o.modalonly = true; |