Skip to content

Commit

Permalink
Add luci nftables patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Oct 19, 2023
1 parent a8eb23d commit 8c8c8d9
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions patches/luci-nftables.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
diff --git a/luci/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js b/luci/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
index d891526..04fd5af 100644
--- a/luci/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
+++ b/luci/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
@@ -672,26 +672,12 @@ return view.extend({
return node;
},

- checkLegacyRules: function(ipt4save, ipt6save) {
- if (ipt4save.match(/\n-A /) || ipt6save.match(/\n-A /)) {
- ui.addNotification(_('Legacy rules detected'), [
- E('p', _('There are legacy iptables rules present on the system. Mixing iptables and nftables rules is discouraged and may lead to incomplete traffic filtering.')),
- E('button', {
- 'class': 'btn cbi-button',
- 'click': function() { location.href = 'nftables/iptables' }
- }, _('Open iptables rules overview…'))
- ], 'warning');
- }
- },
-
render: function(data) {
var view = E('div'),
nft = data[0],
ipt = data[1],
ipt6 = data[2];

- this.checkLegacyRules(ipt, ipt6);
-
if (!Array.isArray(nft.nftables))
return E('em', _('No nftables ruleset loaded.'));

diff --git a/luci/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json b/luci/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
index 190eef0..e9cf485 100644
--- a/luci/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
+++ b/luci/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
@@ -39,20 +39,33 @@
}
},

- "admin/status/nftables": {
+ "admin/status/firewall": {
"title": "Firewall",
"order": 3,
+ "action": {
+ "type": "alias",
+ "path": "admin/status/firewall/nftables"
+ },
+ "depends": {
+ "acl": [ "luci-mod-status-firewall" ]
+ }
+ },
+
+ "admin/status/firewall/nftables": {
+ "title": "NFtables Firewall",
+ "order": 1,
"action": {
"type": "view",
"path": "status/nftables"
},
"depends": {
- "acl": [ "luci-mod-status-firewall" ],
"fs": { "/usr/sbin/nft": "executable" }
}
},

- "admin/status/nftables/iptables": {
+ "admin/status/firewall/iptables": {
+ "title": "IPtables Firewall",
+ "order": 2,
"action": {
"type": "view",
"path": "status/iptables"

0 comments on commit 8c8c8d9

Please sign in to comment.