Hi,

On Tue, 2014-12-16 at 14:31 +0200, pasi.sjoh...@jolla.com wrote:
> From: Pasi Sjöholm <pasi.sjoh...@jollamobile.com>
> 
> Nameservers need to be reset when new addresses are extracted
> so that they are not reused when pdp-protocol e.g. changes
> from ipv6 to dual/ipv4v6.

Nameservers should be removed only when they change, which seems to be
the task when the 'DomainNameServers' property.

> ---
>  plugins/ofono.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/plugins/ofono.c b/plugins/ofono.c
> index 1617764..29dfe90 100644
> --- a/plugins/ofono.c
> +++ b/plugins/ofono.c
> @@ -757,6 +757,8 @@ static void extract_ipv4_settings(DBusMessageIter *array,
>  
>       connman_ipaddress_free(context->ipv4_address);
>       context->ipv4_address = NULL;
> +     g_free(context->ipv4_nameservers);
> +     context->ipv4_nameservers = NULL;
>       context->index = -1;
>  
>       if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
> @@ -860,6 +862,8 @@ static void extract_ipv6_settings(DBusMessageIter *array,
>  
>       connman_ipaddress_free(context->ipv6_address);
>       context->ipv6_address = NULL;
> +     g_free(context->ipv6_nameservers);
> +     context->ipv6_nameservers = NULL;
>       context->index = -1;
>  
>       if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)

At the start of both functions, nameservers is set to NULL. If the
'DomainNameServers' property is set in the message, the nameservers take
the value supplied. At the end of both functions there are these two
lines which appear to remove the old values from the context like so:

        g_free(context->ipv6_nameservers);
        context->ipv6_nameservers = nameservers;

Are you sure the extra freeing is needed?

Cheers,

        Patrik


_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to