[PATCH autoconf v3 06/12] ipv6: Clear the IPv6 address if that address is removed from system

Jukka.Rissanen at nokia.com Jukka.Rissanen at nokia.com
Tue Jan 11 04:45:33 PST 2011


Hi Samuel,

ext Samuel Ortiz wrote:
> I think it would make sense to clear the address every time deladdr
> is called, not only for the IPv6 system address. Something like that: 
> 
> diff --git a/src/ipconfig.c b/src/ipconfig.c index 6ef39c5..bd664f3
> 100644 --- a/src/ipconfig.c
> +++ b/src/ipconfig.c
> @@ -682,7 +682,8 @@ void __connman_ipconfig_deladdr(int index, int
>         family, const ipdevice->address_list =
>                                                                
> g_slist_remove(ipdevice->address_list, ipaddress); 
> 
> -       connman_ipaddress_free(ipaddress);
> +       connman_ipaddress_clear(ipaddress);
> +       g_free(ipaddress);

But isn't connman_ipaddress_free() the same thing as connman_ipaddress_clear()+g_free()?
Meaning that the address was correctly cleared.

> 
>         connman_info("%s {del} address %s/%u label %s",
>                                                 ipdevice->ifname,
> address, prefixlen, label); 
> 
> 
>> So without the patch list-services would return
>> 
>> IPv6 = { PrefixLength=64 Method=off Address=2001::1 }
> I don't know if you actually tested it, but that would be
> de-referencing an already freed pointer. So we definitely need to do
> something about it.  
> 

I definitely tested the patch, valgrind does not give any de-reference errors. Probably because the ipdevice->config_ipv6->system pointer is not freed but it is just cleared.


Jukka



More information about the connman mailing list