summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjack9603301 <jack9603301@163.com>2021-01-23 02:08:12 +0800
committerjack9603301 <jack9603301@163.com>2021-01-23 21:45:31 +0800
commitd5a6817f5dc8c6b6bc015705330efbd02750d801 (patch)
treeb245cc14085e9fbcafb65253aec07227ffd6c3e2
parentd05593e68ff0978c278b13a42f246edcfad3902d (diff)
downloadvyos-1x-d5a6817f5dc8c6b6bc015705330efbd02750d801.tar.gz
vyos-1x-d5a6817f5dc8c6b6bc015705330efbd02750d801.zip
nptv6: T2518: Delete the ndppd configuration file when the ndppd service does not need to be enabled
-rwxr-xr-xsrc/conf_mode/nat66.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/conf_mode/nat66.py b/src/conf_mode/nat66.py
index 7190961e8..f58db04e0 100755
--- a/src/conf_mode/nat66.py
+++ b/src/conf_mode/nat66.py
@@ -153,14 +153,15 @@ def generate(nat):
def apply(nat):
if not nat:
return None
+ cmd(f'{iptables_nat_config}')
+ if 'deleted' in nat or not dict_search('source.rule', nat):
+ cmd('systemctl stop ndppd')
+ if os.path.isfile(ndppd_config):
+ os.unlink(ndppd_config)
else:
- cmd(f'{iptables_nat_config}')
- if 'deleted' in nat or not dict_search('source.rule', nat):
- cmd('systemctl stop ndppd')
- else:
- cmd('systemctl restart ndppd')
- if os.path.isfile(iptables_nat_config):
- os.unlink(iptables_nat_config)
+ cmd('systemctl restart ndppd')
+ if os.path.isfile(iptables_nat_config):
+ os.unlink(iptables_nat_config)
return None