summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-03-04 21:51:45 +0100
committerGitHub <noreply@github.com>2021-03-04 21:51:45 +0100
commitd79c80ff078ac686ae2a4e0da66bfbd40d67f824 (patch)
tree43edad0dc3de95472a065da7d8f1d8ebeb6d6d5a /python/vyos/ifconfig
parentecba3ff3a5d5032da735e0f73983b85918560570 (diff)
parentdd2eb5e5686655c996ae95285b8ad7eb73d63d0b (diff)
downloadvyos-1x-d79c80ff078ac686ae2a4e0da66bfbd40d67f824.tar.gz
vyos-1x-d79c80ff078ac686ae2a4e0da66bfbd40d67f824.zip
Merge pull request #729 from bstepler/T3300
dhcp: T3300: add DHCP default route distance
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r--python/vyos/ifconfig/interface.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index dff9fa810..fe6a3c95e 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -945,6 +945,9 @@ class Interface(Control):
pid_file = f'{config_base}_{ifname}.pid'
lease_file = f'{config_base}_{ifname}.leases'
+ # Stop client with old config files to get the right IF_METRIC.
+ self._cmd(f'systemctl stop dhclient@{ifname}.service')
+
if enable and 'disable' not in self._config:
if dict_search('dhcp_options.host_name', self._config) == None:
# read configured system hostname.
@@ -963,10 +966,8 @@ class Interface(Control):
# 'up' check is mandatory b/c even if the interface is A/D, as soon as
# the DHCP client is started the interface will be placed in u/u state.
# This is not what we intended to do when disabling an interface.
- return self._cmd(f'systemctl restart dhclient@{ifname}.service')
+ return self._cmd(f'systemctl start dhclient@{ifname}.service')
else:
- self._cmd(f'systemctl stop dhclient@{ifname}.service')
-
# cleanup old config files
for file in [config_file, options_file, pid_file, lease_file]:
if os.path.isfile(file):