summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-29 17:24:27 +0200
committerGitHub <noreply@github.com>2024-06-29 17:24:27 +0200
commit7eddd35e177ef5a41c19bb37b0bc80bdf4b8246d (patch)
tree834d1574a21582c62af1e61c662de5004fc4a953 /src/op_mode
parent206c07afc26e826facdaa1b04d697e7f74e55eb0 (diff)
parent5ade35255b3d8438aa6082fe56ae459d50cdc0a5 (diff)
downloadvyos-1x-7eddd35e177ef5a41c19bb37b0bc80bdf4b8246d.tar.gz
vyos-1x-7eddd35e177ef5a41c19bb37b0bc80bdf4b8246d.zip
Merge pull request #3733 from c-po/T6524-release-dhcp
op-mode: T6524: rewrite "release dhcp(v6) interface" to new op-mode format
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/dhcp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index f6029c748..6f57f22a5 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -510,6 +510,16 @@ def renew_client_lease(raw: bool, family: ArgFamily, interface: str):
else:
call(f'systemctl restart dhclient@{interface}.service')
+@_verify_client
+def release_client_lease(raw: bool, family: ArgFamily, interface: str):
+ if not raw:
+ v = 'v6' if family == 'inet6' else ''
+ print(f'Release DHCP{v} client on interface {interface}...')
+ if family == 'inet6':
+ call(f'systemctl stop dhcp6c@{interface}.service')
+ else:
+ call(f'systemctl stop dhclient@{interface}.service')
+
if __name__ == '__main__':
try:
res = vyos.opmode.run(sys.modules[__name__])