summaryrefslogtreecommitdiff
path: root/src/conf_mode/nat.py
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-10-25 12:29:03 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-10-25 22:42:20 +0200
commit2a5273e650ce1242bc22e992e5a3104961ec1295 (patch)
treeae130bd6e6dab4c5c0b1a167e4de1c269b10c328 /src/conf_mode/nat.py
parentec82d60828500a56b6fe8357970bf839053ac0af (diff)
downloadvyos-1x-2a5273e650ce1242bc22e992e5a3104961ec1295.tar.gz
vyos-1x-2a5273e650ce1242bc22e992e5a3104961ec1295.zip
nat: T4764: Remove tables on NAT deletion
Diffstat (limited to 'src/conf_mode/nat.py')
-rwxr-xr-xsrc/conf_mode/nat.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py
index 8b1a5a720..1e807753d 100755
--- a/src/conf_mode/nat.py
+++ b/src/conf_mode/nat.py
@@ -204,6 +204,10 @@ def apply(nat):
cmd(f'nft -f {nftables_nat_config}')
cmd(f'nft -f {nftables_static_nat_conf}')
+ if not nat or 'deleted' in nat:
+ os.unlink(nftables_nat_config)
+ os.unlink(nftables_static_nat_conf)
+
return None
if __name__ == '__main__':