diff options
author | hagbard <vyosdev@derith.de> | 2019-10-09 09:29:29 -0700 |
---|---|---|
committer | hagbard <vyosdev@derith.de> | 2019-10-09 09:29:29 -0700 |
commit | 9b5867b7345e14cd7b738b51ae5b17a524e461f5 (patch) | |
tree | b72d2c335fefd3e1111bb406e2c35fd261a8c7de /src/conf_mode/interface-ethernet.py | |
parent | f8be18fbc549bc574746991bd0bb1de9b424745e (diff) | |
parent | 2d3539f9dec19c0d5cec5bd962aaf9640a8cec23 (diff) | |
download | vyos-1x-9b5867b7345e14cd7b738b51ae5b17a524e461f5.tar.gz vyos-1x-9b5867b7345e14cd7b738b51ae5b17a524e461f5.zip |
Merge branch 'current' into equuleus
Diffstat (limited to 'src/conf_mode/interface-ethernet.py')
-rwxr-xr-x | src/conf_mode/interface-ethernet.py | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py index 317da5772..3cdc03ce5 100755 --- a/src/conf_mode/interface-ethernet.py +++ b/src/conf_mode/interface-ethernet.py @@ -31,6 +31,7 @@ default_config_data = { 'deleted': False, 'dhcp_client_id': '', 'dhcp_hostname': '', + 'dhcp_vendor_class_id': '', 'dhcpv6_prm_only': False, 'dhcpv6_temporary': False, 'disable': False, @@ -66,6 +67,22 @@ 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'] + + if config['dhcp_vendor_class_id']: + opt['vendor_class_id'] = config['dhcp_vendor_class_id'] + + # 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 @@ -134,6 +151,10 @@ def get_config(): if conf.exists('dhcp-options host-name'): eth['dhcp_hostname'] = conf.return_value('dhcp-options host-name') + # DHCP client vendor identifier + if conf.exists('dhcp-options vendor-class-id'): + eth['dhcp_vendor_class_id'] = conf.return_value('dhcp-options vendor-class-id') + # DHCPv6 only acquire config parameters, no address if conf.exists('dhcpv6-options parameters-only'): eth['dhcpv6_prm_only'] = conf.return_value('dhcpv6-options parameters-only') @@ -273,9 +294,21 @@ 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'] + + if eth['dhcp_vendor_class_id']: + opt['vendor_class_id'] = eth['dhcp_vendor_class_id'] + + # 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']) |