Hi Samuel,

> Hi Thierry,
>
> On Wed, Jun 29, 2011 at 10:37:51PM +0200, Thierry Boureille wrote:
>> Hi Marcel,
>> indeed, please find a more readable patch suggestion
>>
>> Best regards
>> Thierry
>>
>> ---
>>  plugins/ofono.c |    5 +++++
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/plugins/ofono.c b/plugins/ofono.c
>> index 0c23462..b75a1fd 100644
>> --- a/plugins/ofono.c
>> +++ b/plugins/ofono.c
>> @@ -422,6 +422,7 @@ static void set_connected(struct network_info *info,
>>  
>>      switch (info->ipv4_method) {
>>      case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
>> +            goto ipv6;
>>      case CONNMAN_IPCONFIG_METHOD_OFF:
>>      case CONNMAN_IPCONFIG_METHOD_MANUAL:
>>      case CONNMAN_IPCONFIG_METHOD_AUTO:
>> @@ -442,6 +443,10 @@ static void set_connected(struct network_info *info,
>>              break;
>>      }
>>  
>> +    connman_network_set_connected(info->network, connected);
>> +    return;
> That looks quite better yes. But it breaks the dual stack case where you have
> both v4 and v6 method set. So we probably need to set a flag in this routine,
> leave the connman_network_set_connected() call where it is right now, and call
> it depending on the flag (true if any of the v4 or v6 method is fixed or
> dhcp).
>
> Cheers,
> Samuel.
I was not aware both method v4 and v6 can be set in the same time. 
Unfortunately I can't do some tests
in ip v6, then I wonder if ipv4 method can be set to 
CONNMAN_IPCONFIG_METHOD_MANUAL while ipv6 method 
is set to CONNMAN_IPCONFIG_METHOD_DHCP for instance. Which method is the one to 
use in such case ?
by the way, please find a patch version 3. 
In another issue I post a v4, just a little different for 'break' and 'return' 
places, I let you
choose the better one, as I'm really not sure how to manage dual case.

Regards
Thierry

---
 plugins/ofono.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index c24165e..a7109aa 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -418,10 +418,13 @@ static gboolean pending_network_is_available(struct 
connman_network *network)
 static void set_connected(struct network_info *info,
                                connman_bool_t connected)
 {
+       gboolean setip = FALSE;
+
        DBG("network %p connected %d", info->network, connected);
 
        switch (info->ipv4_method) {
        case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
+               goto ipv6;
        case CONNMAN_IPCONFIG_METHOD_OFF:
        case CONNMAN_IPCONFIG_METHOD_MANUAL:
        case CONNMAN_IPCONFIG_METHOD_AUTO:
@@ -432,18 +435,20 @@ static void set_connected(struct network_info *info,
                                                        info->ipv4_method);
                connman_network_set_ipaddress(info->network,
                                                        &info->ipv4_address);
-
+               setip = TRUE;
                break;
 
        case CONNMAN_IPCONFIG_METHOD_DHCP:
                connman_network_set_ipv4_method(info->network,
                                                        info->ipv4_method);
-
+               setip = TRUE;
                break;
        }
 
+ipv6:
        switch (info->ipv6_method) {
        case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
+               break;
        case CONNMAN_IPCONFIG_METHOD_OFF:
        case CONNMAN_IPCONFIG_METHOD_MANUAL:
        case CONNMAN_IPCONFIG_METHOD_DHCP:
@@ -455,11 +460,12 @@ static void set_connected(struct network_info *info,
                                                        info->ipv6_method);
                connman_network_set_ipaddress(info->network,
                                                        &info->ipv6_address);
-
+               setip = TRUE;
                break;
        }
 
-       connman_network_set_connected(info->network, connected);
+       if (setip == TRUE)
+               connman_network_set_connected(info->network, connected);
 }
 
 static void set_active_reply(DBusPendingCall *call, void *user_data)
-- 
1.7.3






_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to