Hi,

On Tue, 2012-06-12 at 16:44 +0200, elena.tebe...@gmail.com wrote:
> From: Elena Tebesoi <elena.tebe...@gmail.com>
> 
> A GPRS service can also have IPV6 configuration.
> This patch sets the network index for IPV6.


> -void connman_network_set_index(struct connman_network *network, int index)
> +static void connman_network_set_ipv4_index(struct connman_network *network,
> +                                     struct connman_service *service,
> +                                     int index)
>  {
> -     struct connman_service *service;
>       struct connman_ipconfig *ipconfig;
>  
> -     service = __connman_service_lookup_from_network(network);
> -     if (service == NULL)
> -             goto done;
> -
>       ipconfig = __connman_service_get_ip4config(service);
>  
>       DBG("index %d service %p ip4config %p", network->index,
> -             service, ipconfig);
> +                     service, ipconfig);
>  
>       if (network->index < 0 && ipconfig == NULL) {
>  
> -             ipconfig = __connman_service_get_ip4config(service);
>               if (ipconfig == NULL)
>                       /*
>                        * This is needed for plugins that havent set their
> @@ -489,12 +486,71 @@ void connman_network_set_index(struct connman_network 
> *network, int index)
>       } else {
>               /* If index changed, the index of ipconfig must be reset. */
>               if (ipconfig == NULL)
> -                     goto done;
> +                     return;
>  
>               __connman_ipconfig_set_index(ipconfig, index);
>       }

There is something seriously broken in the original
connman_network_set_index() function. It is called from network plugins
only, but at this point it's not clear if the plugin can know whether
IPv4 or IPv6 configurations are to be used. Probably this function
should set network->index, and service or something should fish up that
index when (finally) setting up the ipconfigs. The purpose of this
function needs more thought.

> +void connman_network_set_index(struct connman_network *network, int index)
> +{
> +     struct connman_service *service;
> +
> +     DBG("index %d network %p", index, network);
> +
> +     service = __connman_service_lookup_from_network(network);
> +     if (service != NULL) {
> +             connman_network_set_ipv4_index(network, service, index);
> +             connman_network_set_ipv6_index(network, service, index);
> +     }
>  
> -done:
>       network->index = index;
>  }

This should probably not be set blindly, in ofono in particular we
should know the PDP context type and thus which versions of IP it
supports, right?

Cheers,

        Patrik


_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to