summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-30 07:23:55 +0200
committerGitHub <noreply@github.com>2024-06-30 07:23:55 +0200
commitee7053d201c8b05611280020abdc6c57b571c154 (patch)
tree33f26ed4713804ef8000245c38576300d284a89f /src
parent679c474e22373d0801459c57fcde8c8c298fe21d (diff)
parent5a9ec0cdb08344c3de573de68e754c1bdc885088 (diff)
downloadvyos-1x-ee7053d201c8b05611280020abdc6c57b571c154.tar.gz
vyos-1x-ee7053d201c8b05611280020abdc6c57b571c154.zip
Merge pull request #3741 from vyos/mergify/bp/sagitta/pr-3733
op-mode: T6524: rewrite "release dhcp(v6) interface" to new op-mode format (backport #3733)
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 3229da4ad..dffd99de5 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -423,6 +423,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__])