Skip to content

Commit

Permalink
fix(nftables): always flush main table on start
Browse files Browse the repository at this point in the history
On start created_tables will not contain the main "firewalld" table so a
flush command is not issued. We should always attempt to flush. If
CleanupOnExit=no, then not flushing causes duplicate rules on restart.

Fixes: rhbz2222044
(cherry picked from commit 6a155ea)
  • Loading branch information
erig0 committed Oct 2, 2023
1 parent 0734f7e commit 4b005c2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/firewall/core/nftables.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,10 @@ def build_flush_rules(self):
self.policy_priority_counts = {}
self.zone_source_index_cache = {}

rules = []
if TABLE_NAME in self.created_tables["inet"]:
rules.append({"delete": {"table": {"family": "inet",
"name": TABLE_NAME}}})
self.created_tables["inet"].remove(TABLE_NAME)
return rules

return self._build_delete_table_rules(TABLE_NAME)

def _build_set_policy_rules_ct_rules(self, enable):
add_del = { True: "add", False: "delete" }[enable]
Expand Down

0 comments on commit 4b005c2

Please sign in to comment.