diff --git a/daemon/core/nodes/netclient.py b/daemon/core/nodes/netclient.py index 99e6569a..84727e7d 100644 --- a/daemon/core/nodes/netclient.py +++ b/daemon/core/nodes/netclient.py @@ -3,6 +3,7 @@ Clients for dealing with bridge/interface commands. """ import json from typing import Callable +import netaddr from core.constants import ETHTOOL_BIN, IP_BIN, OVS_BIN, SYSCTL_BIN, TC_BIN @@ -168,7 +169,7 @@ class LinuxNetClient: ) else: self.run(f"{IP_BIN} address add {address} dev {device}") - if ":" in address: + if netaddr.valid_ipv6(address.split("/")[0]): # IPv6 addresses are removed by default on interface down. # Make sure that the IPv6 address we add is not removed self.run(f"{SYSCTL_BIN} -w net.ipv6.conf.{device}.keep_addr_on_down=1")