Skip to content

Commit 6834b4e

Browse files
committed
Fix: Add default_policy variable to FORWARD_TEMPLATE
1 parent 069e738 commit 6834b4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nft-blackhole.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
SET_TEMPLATE = ('table inet blackhole {\n\tset ${set_name} {\n\t\ttype ${ip_ver}_addr\n'
4444
'\t\tflags interval\n\t\tauto-merge\n\t\telements = { ${ip_list} }\n\t}\n}').expandtabs()
4545

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

9494
if BLOCK_FORWARD:
95-
chain_forward = Template(FORWARD_TEMPLATE).substitute(block_policy=block_policy,
95+
chain_forward = Template(FORWARD_TEMPLATE).substitute(default_policy=default_policy,
96+
block_policy=block_policy,
9697
country_policy=country_policy,
9798
country_ex_ports_rule=country_ex_ports_rule)
9899
else:

0 commit comments

Comments
 (0)