summaryrefslogtreecommitdiff
path: root/src/conf_mode/interface-bridge.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-13 12:34:10 +0200
committerChristian Poessinger <christian@poessinger.com>2019-10-13 12:34:15 +0200
commit67ca26dc6f6e548dfd0a1bc787aa039d96450b97 (patch)
treec1ba321ab09b882683461a7d04d30691e88613f9 /src/conf_mode/interface-bridge.py
parent177de5378a1e9e6983e34ef4a5244310b78d870a (diff)
downloadvyos-1x-67ca26dc6f6e548dfd0a1bc787aa039d96450b97.tar.gz
vyos-1x-67ca26dc6f6e548dfd0a1bc787aa039d96450b97.zip
Python/ifconfig: T1557: add support for DHCPv6 client options
Diffstat (limited to 'src/conf_mode/interface-bridge.py')
-rwxr-xr-xsrc/conf_mode/interface-bridge.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py
index 57ac98444..70bf4f528 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interface-bridge.py
@@ -100,11 +100,11 @@ def get_config():
# DHCPv6 only acquire config parameters, no address
if conf.exists('dhcpv6-options parameters-only'):
- bridge['dhcpv6_prm_only'] = conf.return_value('dhcpv6-options parameters-only')
+ bridge['dhcpv6_prm_only'] = True
# DHCPv6 temporary IPv6 address
if conf.exists('dhcpv6-options temporary'):
- bridge['dhcpv6_temporary'] = conf.return_value('dhcpv6-options temporary')
+ bridge['dhcpv6_temporary'] = True
# Disable this bridge interface
if conf.exists('disable'):
@@ -174,6 +174,9 @@ def get_config():
return bridge
def verify(bridge):
+ if bridge['dhcpv6_prm_only'] and bridge['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
conf = Config()
for br in conf.list_nodes('interfaces bridge'):
# it makes no sense to verify ourself in this case
@@ -240,10 +243,21 @@ def apply(bridge):
if bridge['dhcp_vendor_class_id']:
opt['vendor_class_id'] = bridge['dhcp_vendor_class_id']
- # store DHCP config dictionary - used later on when addresses
- # are requested
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
br.set_dhcp_options(opt)
+ # get DHCPv6 config dictionary and update values
+ opt = br.get_dhcpv6_options()
+
+ if bridge['dhcpv6_prm_only']:
+ opt['dhcpv6_prm_only'] = True
+
+ if bridge['dhcpv6_temporary']:
+ opt['dhcpv6_temporary'] = True
+
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
+ br.set_dhcpv6_options(opt)
+
# Change interface MAC address
if bridge['mac']:
br.set_mac(bridge['mac'])