Skip to content

Commit

Permalink
Fix: Add default_policy variable to FORWARD_TEMPLATE
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasz-c committed Jan 7, 2025
1 parent 069e738 commit 6834b4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nft-blackhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
SET_TEMPLATE = ('table inet blackhole {\n\tset ${set_name} {\n\t\ttype ${ip_ver}_addr\n'
'\t\tflags interval\n\t\tauto-merge\n\t\telements = { ${ip_list} }\n\t}\n}').expandtabs()

FORWARD_TEMPLATE = ('\tchain forward {\n\t\ttype filter hook forward priority -1; policy accept;\n'
FORWARD_TEMPLATE = ('\tchain forward {\n\t\ttype filter hook forward priority -1; policy ${default_policy};\n'
'\t\tct state established,related accept\n'
'\t\tip saddr @whitelist-v4 counter accept\n'
'\t\tip6 saddr @whitelist-v6 counter accept\n'
Expand Down Expand Up @@ -92,7 +92,8 @@
chain_output = ''

if BLOCK_FORWARD:
chain_forward = Template(FORWARD_TEMPLATE).substitute(block_policy=block_policy,
chain_forward = Template(FORWARD_TEMPLATE).substitute(default_policy=default_policy,
block_policy=block_policy,
country_policy=country_policy,
country_ex_ports_rule=country_ex_ports_rule)
else:
Expand Down

0 comments on commit 6834b4e

Please sign in to comment.