summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-27 21:34:14 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-06-29 15:25:17 +0000
commite88c3f9e618212f97a61fa82948caf4b431cd6eb (patch)
tree1cb26763aba2ed12c9d86db347e1837f08e2543a /src
parent551dfa5c47d19b62fbfba5e26e357f93546ff4d8 (diff)
downloadvyos-1x-e88c3f9e618212f97a61fa82948caf4b431cd6eb.tar.gz
vyos-1x-e88c3f9e618212f97a61fa82948caf4b431cd6eb.zip
op-mode: T6524: rewrite "release dhcp(v6) interface" to new op-mode format
(cherry picked from commit 5ade35255b3d8438aa6082fe56ae459d50cdc0a5)
Diffstat (limited to 'src')
-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__])