From d5a6817f5dc8c6b6bc015705330efbd02750d801 Mon Sep 17 00:00:00 2001 From: jack9603301 Date: Sat, 23 Jan 2021 02:08:12 +0800 Subject: nptv6: T2518: Delete the ndppd configuration file when the ndppd service does not need to be enabled --- src/conf_mode/nat66.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/conf_mode') 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 -- cgit v1.2.3