When IPv6 address is added to an interface there are actually two
RTM_NEWADDR netlink messages sent. The second message is sent
when DAD is complete and tentative flag is removed.
For the second message associated with the same address we have to
check if the flags have changed and update them in the Device instance
to be in sync.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Devices/Device.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lnst/Devices/Device.py b/lnst/Devices/Device.py
index e69a297f..112a9276 100644
--- a/lnst/Devices/Device.py
+++ b/lnst/Devices/Device.py
@@ -210,6 +210,13 @@ class Device(object, metaclass=DeviceMeta):
if addr not in self._ip_addrs:
self._ip_addrs.append(addr)
+ else:
+ old_idx = self._ip_addrs.index(addr)
+ addr_old = self._ip_addrs[old_idx]
+ if addr.flags != addr_old.flags:
+ self._ip_addrs.pop(old_idx)
+ self._ip_addrs.append(addr)
+
elif nl_msg['header']['type'] == RTM_DELADDR:
addr = ipaddress(nl_msg.get_attr('IFA_ADDRESS'))
addr.prefixlen = nl_msg["prefixlen"]
--
2.21.1