summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-firewall
diff options
context:
space:
mode:
authorArınç ÜNAL <arinc.unal@arinc9.com>2022-10-11 22:17:34 +0300
committerPaul Donald <newtwen+github@gmail.com>2024-10-23 05:34:50 +0200
commit46e6b9ba44a33937c7ba89273da9d2f7fde985ad (patch)
tree18e6cf78156ba70e18f8d02187db2d5a5dd49521 /applications/luci-app-firewall
parent83a147ea79b479c5b560486e9937264848b15024 (diff)
luci-app-firewall: make a dropdown list for flow offloading options
Either software or hardware offloading is in use at a time. Make a dropdown list for them to reflect this on the firewall section of LuCI. Closes #6247 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com> Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'applications/luci-app-firewall')
-rw-r--r--applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
index a91d4cb975..fdb77c9116 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
@@ -79,16 +79,22 @@ return view.extend({
s.anonymous = true;
s.addremove = false;
- o = s.option(form.Flag, 'flow_offloading',
- _('Software flow offloading'),
- _('Software based offloading for routing/NAT'));
- o.optional = true;
-
- o = s.option(form.Flag, 'flow_offloading_hw',
- _('Hardware flow offloading'),
- _('Requires hardware NAT support.'));
- o.optional = true;
- o.depends('flow_offloading', '1');
+ o = s.option(form.RichListValue, "offloading_type", _("Offloading type"));
+ o.value('0', _("None"));
+ o.value('1', _("Software offloading"), _('Software based offloading for routing with/without NAT.'));
+ o.value('2', _("Hardware offloading"), _('Hardware based offloading for routing with/without NAT. Requires hardware support.'));
+ o.optional = false;
+ o.load = function (section_id) {
+ var flow_offloading = uci.get('firewall', section_id, 'flow_offloading');
+ var flow_offloading_hw = uci.get('firewall', section_id, 'flow_offloading_hw');
+ return (flow_offloading === '1')
+ ? (flow_offloading_hw === '1' ? '2' : '1')
+ : '0';
+ };
+ o.write = function(section_id, value) {
+ uci.set('firewall', section_id, 'flow_offloading', value === '0' ? null : '1');
+ uci.set('firewall', section_id, 'flow_offloading_hw', value === '2' ? '1' : null);
+ };
}