summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-13 12:49:47 +0200
committerChristian Poessinger <christian@poessinger.com>2019-10-13 12:49:47 +0200
commit79bc826426385e5b40fbe58137d0a2d2831cf274 (patch)
treee21c70c44c5889c3b37eabf9e7a7d6095f842a69 /src
parent5c834feebe5e7749ec731dcf9556ae6997b0b526 (diff)
parentfe7279454c86a2947b23fb0d769483b7fe2a3cc3 (diff)
downloadvyos-1x-79bc826426385e5b40fbe58137d0a2d2831cf274.tar.gz
vyos-1x-79bc826426385e5b40fbe58137d0a2d2831cf274.zip
Merge branch 'current' of github.com:vyos/vyos-1x into equuleus
* 'current' of github.com:vyos/vyos-1x: Sync XML interface description source file pattern and conf script name Python/ifconfig: T1557: add support for DHCPv6 client options bonding: T1614: support DHCP options on VLAN interfaces Python/ifconfig: T1557: bugfix when configuring accept_ra on VLAN interfaces conf_mode: bonding/ethernet fix comments Jenkins: Docker: always pull container from Dockerhub
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py (renamed from src/conf_mode/interface-bonding.py)65
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py (renamed from src/conf_mode/interface-bridge.py)22
-rwxr-xr-xsrc/conf_mode/interfaces-dummy.py (renamed from src/conf_mode/interface-dummy.py)0
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py (renamed from src/conf_mode/interface-ethernet.py)53
-rwxr-xr-xsrc/conf_mode/interfaces-loopback.py (renamed from src/conf_mode/interface-loopback.py)0
-rwxr-xr-xsrc/conf_mode/interfaces-openvpn.py (renamed from src/conf_mode/interface-openvpn.py)0
-rwxr-xr-xsrc/conf_mode/interfaces-vxlan.py (renamed from src/conf_mode/interface-vxlan.py)0
-rwxr-xr-xsrc/conf_mode/interfaces-wireguard.py (renamed from src/conf_mode/interface-wireguard.py)0
8 files changed, 122 insertions, 18 deletions
diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interfaces-bonding.py
index 49d2a05d4..8a0f9f84d 100755
--- a/src/conf_mode/interface-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -84,6 +84,33 @@ 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 aquired
+ vlan.set_dhcp_options(opt)
+
+ # get DHCPv6 config dictionary and update values
+ opt = vlan.get_dhcpv6_options()
+
+ if config['dhcpv6_prm_only']:
+ opt['dhcpv6_prm_only'] = True
+
+ if config['dhcpv6_temporary']:
+ opt['dhcpv6_temporary'] = True
+
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
+ vlan.set_dhcpv6_options(opt)
+
# update interface description used e.g. within SNMP
vlan.set_alias(config['description'])
# ignore link state changes
@@ -171,11 +198,11 @@ def get_config():
# DHCPv6 only acquire config parameters, no address
if conf.exists('dhcpv6-options parameters-only'):
- bond['dhcpv6_prm_only'] = conf.return_value('dhcpv6-options parameters-only')
+ bond['dhcpv6_prm_only'] = True
# DHCPv6 temporary IPv6 address
if conf.exists('dhcpv6-options temporary'):
- bond['dhcpv6_temporary'] = conf.return_value('dhcpv6-options temporary')
+ bond['dhcpv6_temporary'] = True
# ignore link state changes
if conf.exists('disable-link-detect'):
@@ -221,7 +248,7 @@ def get_config():
if conf.exists('primary'):
bond['primary'] = conf.return_value('primary')
- # re-set configuration level and retrieve vif-s interfaces
+ # re-set configuration level to parse new nodes
conf.set_level(cfg_base)
# get vif-s interfaces (currently effective) - to determine which vif-s
# interface is no longer present and needs to be removed
@@ -235,7 +262,7 @@ def get_config():
conf.set_level(cfg_base + ' vif-s ' + vif_s)
bond['vif_s'].append(vlan_to_dict(conf))
- # re-set configuration level and retrieve vif-s interfaces
+ # re-set configuration level to parse new nodes
conf.set_level(cfg_base)
# Determine vif interfaces (currently effective) - to determine which
# vif interface is no longer present and needs to be removed
@@ -265,6 +292,21 @@ def verify(bond):
raise ConfigError('Interface "{}" is not part of the bond' \
.format(bond['primary']))
+
+ # DHCPv6 parameters-only and temporary address are mutually exclusive
+ for vif_s in bond['vif_s']:
+ if vif_s['dhcpv6_prm_only'] and vif_s['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+ for vif_c in vif_s['vif_c']:
+ if vif_c['dhcpv6_prm_only'] and vif_c['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+ for vif in bond['vif']:
+ if vif['dhcpv6_prm_only'] and vif['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+
for vif_s in bond['vif_s']:
for vif in bond['vif']:
if vif['id'] == vif_s['id']:
@@ -385,10 +427,21 @@ def apply(bond):
if bond['dhcp_vendor_class_id']:
opt['vendor_class_id'] = bond['dhcp_vendor_class_id']
- # store DHCP config dictionary - used later on when addresses
- # are requested
+ # store DHCP config dictionary - used later on when addresses are aquired
b.set_dhcp_options(opt)
+ # get DHCPv6 config dictionary and update values
+ opt = b.get_dhcpv6_options()
+
+ if bond['dhcpv6_prm_only']:
+ opt['dhcpv6_prm_only'] = True
+
+ if bond['dhcpv6_temporary']:
+ opt['dhcpv6_temporary'] = True
+
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
+ b.set_dhcpv6_options(opt)
+
# ignore link state changes
b.set_link_detect(bond['disable_link_detect'])
# Bonding transmit hash policy
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interfaces-bridge.py
index 57ac98444..70bf4f528 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interfaces-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'])
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interfaces-dummy.py
index eb0145f65..eb0145f65 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interfaces-dummy.py
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 3cdc03ce5..cd40aff3e 100755
--- a/src/conf_mode/interface-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -79,10 +79,21 @@ def apply_vlan_config(vlan, config):
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
+ # store DHCP config dictionary - used later on when addresses are aquired
vlan.set_dhcp_options(opt)
+ # get DHCPv6 config dictionary and update values
+ opt = vlan.get_dhcpv6_options()
+
+ if config['dhcpv6_prm_only']:
+ opt['dhcpv6_prm_only'] = True
+
+ if config['dhcpv6_temporary']:
+ opt['dhcpv6_temporary'] = True
+
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
+ vlan.set_dhcpv6_options(opt)
+
# update interface description used e.g. within SNMP
vlan.set_alias(config['description'])
# ignore link state changes
@@ -157,11 +168,11 @@ def get_config():
# 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')
+ eth['dhcpv6_prm_only'] = True
# DHCPv6 temporary IPv6 address
if conf.exists('dhcpv6-options temporary'):
- eth['dhcpv6_temporary'] = conf.return_value('dhcpv6-options temporary')
+ eth['dhcpv6_temporary'] = True
# ignore link state changes
if conf.exists('disable-link-detect'):
@@ -227,7 +238,7 @@ def get_config():
if conf.exists('speed'):
eth['speed'] = conf.return_value('speed')
- # re-set configuration level and retrieve vif-s interfaces
+ # re-set configuration level to parse new nodes
conf.set_level(cfg_base)
# get vif-s interfaces (currently effective) - to determine which vif-s
# interface is no longer present and needs to be removed
@@ -241,7 +252,7 @@ def get_config():
conf.set_level(cfg_base + ' vif-s ' + vif_s)
eth['vif_s'].append(vlan_to_dict(conf))
- # re-set configuration level and retrieve vif-s interfaces
+ # re-set configuration level to parse new nodes
conf.set_level(cfg_base)
# Determine vif interfaces (currently effective) - to determine which
# vif interface is no longer present and needs to be removed
@@ -270,6 +281,9 @@ def verify(eth):
if eth['speed'] != 'auto':
raise ConfigError('If duplex is hardcoded, speed must be hardcoded, too')
+ if eth['dhcpv6_prm_only'] and eth['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
conf = Config()
# some options can not be changed when interface is enslaved to a bond
for bond in conf.list_nodes('interfaces bonding'):
@@ -279,6 +293,18 @@ def verify(eth):
if eth['address']:
raise ConfigError('Can not assign address to interface {} which is a member of {}').format(eth['intf'], bond)
+ # DHCPv6 parameters-only and temporary address are mutually exclusive
+ for vif_s in eth['vif_s']:
+ if vif_s['dhcpv6_prm_only'] and vif_s['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+ for vif_c in vif_s['vif_c']:
+ if vif_c['dhcpv6_prm_only'] and vif_c['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+ for vif in eth['vif']:
+ if vif['dhcpv6_prm_only'] and vif['dhcpv6_temporary']:
+ raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
return None
@@ -306,10 +332,21 @@ def apply(eth):
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
+ # store DHCP config dictionary - used later on when addresses are aquired
e.set_dhcp_options(opt)
+ # get DHCPv6 config dictionary and update values
+ opt = e.get_dhcpv6_options()
+
+ if eth['dhcpv6_prm_only']:
+ opt['dhcpv6_prm_only'] = True
+
+ if eth['dhcpv6_temporary']:
+ opt['dhcpv6_temporary'] = True
+
+ # store DHCPv6 config dictionary - used later on when addresses are aquired
+ e.set_dhcpv6_options(opt)
+
# ignore link state changes
e.set_link_detect(eth['disable_link_detect'])
# disable ethernet flow control (pause frames)
diff --git a/src/conf_mode/interface-loopback.py b/src/conf_mode/interfaces-loopback.py
index 10722d137..10722d137 100755
--- a/src/conf_mode/interface-loopback.py
+++ b/src/conf_mode/interfaces-loopback.py
diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interfaces-openvpn.py
index 5345bf7a2..5345bf7a2 100755
--- a/src/conf_mode/interface-openvpn.py
+++ b/src/conf_mode/interfaces-openvpn.py
diff --git a/src/conf_mode/interface-vxlan.py b/src/conf_mode/interfaces-vxlan.py
index 1097ae4d0..1097ae4d0 100755
--- a/src/conf_mode/interface-vxlan.py
+++ b/src/conf_mode/interfaces-vxlan.py
diff --git a/src/conf_mode/interface-wireguard.py b/src/conf_mode/interfaces-wireguard.py
index 7a684bafa..7a684bafa 100755
--- a/src/conf_mode/interface-wireguard.py
+++ b/src/conf_mode/interfaces-wireguard.py