mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: address: enable ipv6 before adding new address
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -461,8 +461,19 @@ class address(Addon, moduleBase):
|
||||
return True, user_config_ip_addrs_list
|
||||
|
||||
def __add_ip_addresses_with_attributes(self, ifaceobj, ifname, user_config_ip_addrs):
|
||||
ipv6_is_disabled = None
|
||||
try:
|
||||
for ip, attributes in user_config_ip_addrs:
|
||||
|
||||
if ip.version == 6 and ipv6_is_disabled is None:
|
||||
# check (only once) if ipv6 is disabled on this device
|
||||
proc_path = "/proc/sys/net/ipv6/conf/%s/disable_ipv6" % ifname
|
||||
ipv6_is_disabled = utils.get_boolean_from_string(self.read_file_oneline(proc_path))
|
||||
|
||||
if ipv6_is_disabled:
|
||||
# enable ipv6
|
||||
self.write_file(proc_path, "0")
|
||||
|
||||
if attributes:
|
||||
self.netlink.addr_add(
|
||||
ifname, ip,
|
||||
|
Reference in New Issue
Block a user