diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-10-08 21:23:57 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-10-09 17:19:03 +0200 |
commit | afc82770cce851da31267829f1726f85093d9d76 (patch) | |
tree | 737581797aa07cebad9d3f1cec8eb50b29505ca4 /src/conf_mode/interface-ethernet.py | |
parent | 21fe962befb2ebd1625eb7a6c28cb3e9005fe37e (diff) | |
download | vyos-1x-afc82770cce851da31267829f1726f85093d9d76.tar.gz vyos-1x-afc82770cce851da31267829f1726f85093d9d76.zip |
Python/ifconfig: T1557: add generic support for DHCP client options
Diffstat (limited to 'src/conf_mode/interface-ethernet.py')
-rwxr-xr-x | src/conf_mode/interface-ethernet.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py index 317da5772..5f9b4d8b0 100755 --- a/src/conf_mode/interface-ethernet.py +++ b/src/conf_mode/interface-ethernet.py @@ -66,6 +66,19 @@ def apply_vlan_config(vlan, config): if type(vlan) != type(VLANIf("lo")): raise TypeError() + # get DHCP config dictionary and update values + opt = vlan.get_dhcp_options() + + if config['dhcp_client_id']: + opt['client_id'] = config['dhcp_client_id'] + + if config['dhcp_hostname']: + opt['hostname'] = config['dhcp_hostname'] + + # store DHCP config dictionary - used later on when addresses + # are requested + vlan.set_dhcp_options(opt) + # update interface description used e.g. within SNMP vlan.set_alias(config['description']) # ignore link state changes @@ -273,9 +286,18 @@ def apply(eth): # update interface description used e.g. within SNMP e.set_alias(eth['description']) - # - # missing DHCP/DHCPv6 options go here - # + # get DHCP config dictionary and update values + opt = e.get_dhcp_options() + + if eth['dhcp_client_id']: + opt['client_id'] = eth['dhcp_client_id'] + + if eth['dhcp_hostname']: + opt['hostname'] = eth['dhcp_hostname'] + + # store DHCP config dictionary - used later on when addresses + # are requested + e.set_dhcp_options(opt) # ignore link state changes e.set_link_detect(eth['disable_link_detect']) |