summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python-ethtool/etherinfo.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c
index 3350cf9..3d2072b 100644
--- a/python-ethtool/etherinfo.c
+++ b/python-ethtool/etherinfo.c
@@ -319,6 +319,14 @@ int get_etherinfo(struct etherinfo *ethinf, struct nl_handle *nlc, nlQuery query
addr_cache = rtnl_addr_alloc_cache(nlc);
addr = rtnl_addr_alloc();
rtnl_addr_set_ifindex(addr, ethinf->index);
+
+ /* Make sure we don't have any old IPv6 addresses saved */
+ if( ethinf->ipv6_addresses ) {
+ free_ipv6addresses(ethinf->ipv6_addresses);
+ ethinf->ipv6_addresses = NULL;
+ }
+
+ /* Retrieve all address information */
nl_cache_foreach_filter(addr_cache, (struct nl_object *)addr, callback_nl_address, ethinf);
rtnl_addr_put(addr);
nl_cache_free(addr_cache);