diff options
author | David Sommerseth <davids@redhat.com> | 2011-01-19 16:32:29 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-01-19 16:32:29 +0100 |
commit | a01edbcc4148c191ac22a76a858d9dff674a0f74 (patch) | |
tree | 877f900274fc397939c16a7f08a4e081f1bcfaab | |
parent | e842b88809a9e2949be6aa8c63dc29b152f7bb3b (diff) | |
download | python-ethtool-a01edbcc4148c191ac22a76a858d9dff674a0f74.tar.gz python-ethtool-a01edbcc4148c191ac22a76a858d9dff674a0f74.tar.xz python-ethtool-a01edbcc4148c191ac22a76a858d9dff674a0f74.zip |
Avoid duplicating IPv6 address information
In commit c52ed2cbdc5b851ebc7bc19d7c682b14a4a16ba4 a free_ipv6addresses()
call was removed, which lead to duplicated IPv6 address information in some
cases. Re-add this freeing, to be sure we don't add existing information to
an already existing pointer chain.
Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r-- | python-ethtool/etherinfo.c | 8 |
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); |