On Wed, Jan 13, 2016 at 2:58 AM, Patrik Flykt <Patrik.Flykt@linux.intel.com> wrote:

        Hi,

On Mon, 2015-12-28 at 00:49 -0800, Naveen Singh wrote:
> From: nasingh <naveensingh0977@gmail.com>
>
> When the DHCP renewal fails dhcp_failure is called which in turn calls
>  __connman_connection_gateway_remove. This function unlike its
> counterpart (__connman_connection_gateway_add which does the
> service transition to READY) does not the change the state to
> CONFIGURATION. This causes the service state to be stuck at ONLINE.
> ---
>  src/connection.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/connection.c b/src/connection.c
> index aa4e1c0..3cb428c 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -1014,6 +1014,16 @@ void __connman_connection_gateway_remove(struct connman_service *service,
>               if (data)
>                       set_default_gateway(data, type);
>       }
> +
> +     if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
> +             __connman_service_ipconfig_indicate_state(service,
> +                             CONNMAN_SERVICE_STATE_CONFIGURATION,
> +                             CONNMAN_IPCONFIG_TYPE_IPV4);
> +
> +     if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
> +             __connman_service_ipconfig_indicate_state(service,
> +                             CONNMAN_SERVICE_STATE_CONFIGURATION,
> +                             CONNMAN_IPCONFIG_TYPE_IPV6);
>  }
>
>  bool __connman_connection_update_gateway(void)

This does not look right. A service can still be in state 'ready' even
if it is missing a gateway. The service transition needs to be done
elsewhere, perhaps in dhcp_failure(). The current
__connman_connection_gateway_add() doing service transitions doesn't
look right either.

I understand. I added this change in  service_ip_release call back but it has side-effects in case when device gets a valid IPv4 address after having a 169 Link local. Following is the order of events:
1.  Device gets a link local address and service IPv4 state changes to ready
2. Device keeps on sending discover request to look for a valid DHCP server
3. Once it finds a DHCP server, it goes through the normal state machine of DHCP and gets an IPv4 address and state transition is done to ready.
4. Now once we have a valid IPv4 address we delete 169 address which would again end up calling service_ip_release and state would go back to configuration.


Cheers,

        Patrik

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