Don’t print empty element lists in nftables
Because nft chokes on them.
This commit is contained in:
parent
e84cb26dc7
commit
5ba9c03e23
|
@ -81,7 +81,7 @@ def save_config():
|
||||||
return f'''\
|
return f'''\
|
||||||
set {name} {{
|
set {name} {{
|
||||||
type {"ipv6_addr" if name.endswith('/6') else "ipv4_addr"}; flags interval
|
type {"ipv6_addr" if name.endswith('/6') else "ipv4_addr"}; flags interval
|
||||||
elements = {{ {', '.join(ips)} }}
|
{"" if ips else "# "}elements = {{ {", ".join(ips)} }}
|
||||||
}}'''
|
}}'''
|
||||||
for name, ips in ipsets.items():
|
for name, ips in ipsets.items():
|
||||||
print(format_set(name, ips), file=f)
|
print(format_set(name, ips), file=f)
|
||||||
|
|
Loading…
Reference in a new issue