mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: addressvirtual: address-virtual-ipv6-addrgen reset to default if removed from stanza
Ticket: CM-21656
Reviewed By: Roopa
Testing Done:
[8:39:13] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
address 192.168.10.1/24
address fc00:10::1/64
address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
address-virtual-ipv6-addrgen off
vlan-id 1000
vlan-raw-device bridge
[8:39:18] root:~ # nano /etc/network/interfaces
[8:39:24] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
address 192.168.10.1/24
address fc00:10::1/64
address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
vlan-id 1000
vlan-raw-device bridge
[8:39:27] root:~ # ifreload -a -v |& grep addrgenmode
link set dev vlan1000-v0 addrgenmode eui64
[8:39:34] root:~ #
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -73,6 +73,8 @@ class addressvirtual(moduleBase):
|
||||
default=True
|
||||
)
|
||||
|
||||
self.address_virtual_ipv6_addrgen_value_dict = {'on': 0, 'yes': 0, '0': 0, 'off': 1, 'no': 1, '1': 1}
|
||||
|
||||
def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None):
|
||||
if ifaceobj.get_attr_value('address-virtual'):
|
||||
ifaceobj.link_privflags |= ifaceLinkPrivFlags.ADDRESS_VIRTUAL_SLAVE
|
||||
@@ -207,15 +209,22 @@ class addressvirtual(moduleBase):
|
||||
# IFLA_INET6_ADDR_GEN_MODE values:
|
||||
# 0 = eui64
|
||||
# 1 = none
|
||||
ipv6_addrgen_nl = {'on': 0, 'yes': 0, '0': 0, 'off': 1, 'no': 1, '1': 1}.get(ipv6_addrgen.lower(), None)
|
||||
ipv6_addrgen_nl = self.address_virtual_ipv6_addrgen_value_dict.get(ipv6_addrgen.lower(), None)
|
||||
|
||||
if ipv6_addrgen_nl is None:
|
||||
self.logger.warning('%s: value "%s" not allowed for attribute "ipv6-addrgen"' % (ifaceobj.name, user_configured_ipv6_addrgen))
|
||||
|
||||
self.logger.warning('%s: invalid value "%s" for attribute address-virtual-ipv6-addrgen' % (ifaceobj.name, ipv6_addrgen))
|
||||
else:
|
||||
return True, ipv6_addrgen_nl
|
||||
|
||||
else:
|
||||
# if user didn't configure ipv6-addrgen, should we reset to default?
|
||||
ipv6_addrgen_nl = self.address_virtual_ipv6_addrgen_value_dict.get(
|
||||
self.get_attr_default_value('address-virtual-ipv6-addrgen'),
|
||||
None
|
||||
)
|
||||
if ipv6_addrgen_nl is not None:
|
||||
return True, ipv6_addrgen_nl
|
||||
|
||||
return False, None
|
||||
|
||||
def _apply_address_config(self, ifaceobj, address_virtual_list):
|
||||
|
||||
Reference in New Issue
Block a user