From 5ade35255b3d8438aa6082fe56ae459d50cdc0a5 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 27 Jun 2024 21:34:14 +0200 Subject: op-mode: T6524: rewrite "release dhcp(v6) interface" to new op-mode format --- src/op_mode/dhcp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/op_mode') 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__]) -- cgit v1.2.3