summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-08-30 16:32:47 +0200
committerGitHub <noreply@github.com>2022-08-30 16:32:47 +0200
commit74f73bcebcfcd15ee5192ee5edc251f868101f30 (patch)
treeaff8fd916f6c6c1ced23cb3d8cbf3c5532228ab7 /src/conf_mode
parent938f83e1454f93ce8156727e03b749e8cf2b27f5 (diff)
parentaa9633b4358c571e58710dba5330f72f7f893304 (diff)
downloadvyos-1x-74f73bcebcfcd15ee5192ee5edc251f868101f30.tar.gz
vyos-1x-74f73bcebcfcd15ee5192ee5edc251f868101f30.zip
Merge pull request #1505 from sever-sever/T4367
nat: T4367: Move nat rules from /tmp to /run/nftables_nat.conf
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/nat.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py
index 85819a77e..a72e82a83 100755
--- a/src/conf_mode/nat.py
+++ b/src/conf_mode/nat.py
@@ -44,7 +44,7 @@ if LooseVersion(kernel_version()) > LooseVersion('5.1'):
else:
k_mod = ['nft_nat', 'nft_chain_nat_ipv4']
-nftables_nat_config = '/tmp/vyos-nat-rules.nft'
+nftables_nat_config = '/run/nftables_nat.conf'
def get_handler(json, chain, target):
""" Get nftable rule handler number of given chain/target combination.
@@ -186,16 +186,12 @@ def generate(nat):
# dry-run newly generated configuration
tmp = run(f'nft -c -f {nftables_nat_config}')
if tmp > 0:
- if os.path.exists(nftables_nat_config):
- os.unlink(nftables_nat_config)
raise ConfigError('Configuration file errors encountered!')
return None
def apply(nat):
cmd(f'nft -f {nftables_nat_config}')
- if os.path.isfile(nftables_nat_config):
- os.unlink(nftables_nat_config)
return None