diff options
| author | Chris Cowart <ccowart@timesinks.net> | 2025-12-07 13:22:06 -0800 |
|---|---|---|
| committer | Chris Cowart <ccowart@timesinks.net> | 2025-12-09 22:55:32 -0800 |
| commit | 3ae47d81e1e990de7fc5260e61227b9ef7044d92 (patch) | |
| tree | 102d492107aade54f9214cc2ab9e3cda2df7a53c /src | |
| parent | 477ada14a4cfb682ef2cc611b82296dbda420baf (diff) | |
| download | vyos-1x-3ae47d81e1e990de7fc5260e61227b9ef7044d92.tar.gz vyos-1x-3ae47d81e1e990de7fc5260e61227b9ef7044d92.zip | |
T8078: dhcpv6: allow lease renew for pd & parameters
The renew command will refuse to restart the dhcp6c process for an
interface unless it is configured to request an address, but the
client may also be running to manage parameters and/or prefix
delegations.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/op_mode/dhcp.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py index 7c4c545fc..9cb5a84ae 100755 --- a/src/op_mode/dhcp.py +++ b/src/op_mode/dhcp.py @@ -308,11 +308,31 @@ def _verify_client(func): v = 'v6' if family == 'inet6' else '' interface = kwargs.get('interface') interface_path = Section.get_config_path(interface) + path_elems = interface_path.split() + base_path = ['interfaces'] + path_elems + unconf_message = f'DHCP{v} client not configured on interface {interface}!' - # Check if config does not exist - if not config.exists(f'interfaces {interface_path} address dhcp{v}'): + iface_conf = config.get_config_dict( + base_path, key_mangling=('-', '_'), get_first_key=True + ) + + if family == 'inet6': + addrs = iface_conf.get('address', []) + has_dhcpv6_addr = 'dhcpv6' in addrs + + dhcpv6_opts = iface_conf.get('dhcpv6_options', {}) + has_parameters_only = 'parameters_only' in dhcpv6_opts + has_pd = 'pd' in dhcpv6_opts + + config_exists = has_dhcpv6_addr or has_parameters_only or has_pd + else: + addrs = iface_conf.get('address', []) + config_exists = 'dhcp' in addrs + + if not config_exists: raise vyos.opmode.UnconfiguredObject(unconf_message) + return func(*args, **kwargs) return _wrapper |
