On Wed, Dec 16, 2015 at 9:02 PM, Naveen Singh <naveensingh0977@gmail.com> wrote:
From: nasingh <naveensingh0977@gmail.com>

If DHCP renewal fails and eventually lease expiry happens the
service state machine was still left to online. This change changes
ipv4 service state to configuration when ipv4 address is released.
 src/service.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/service.c b/src/service.c
index abf0899..52fd6e8 100644
--- a/src/service.c
+++ b/src/service.c
@@ -6377,6 +6377,12 @@ static void service_ip_release(struct connman_ipconfig *ipconfig,

+       if (type == CONNMAN_IPCONFIG_TYPE_IPV4 &&
+                       method == CONNMAN_IPCONFIG_METHOD_DHCP)
+               __connman_service_ipconfig_indicate_state(service,
+                               CONNMAN_SERVICE_STATE_CONFIGURATION,
+                               CONNMAN_IPCONFIG_TYPE_IPV4);
        settings_changed(service, ipconfig);
Hi Patrik
I realized that there is a better way to do the service transition. DHCP results get communicated to network code through the registered call back (through dhcp_result in network.c). On success dhcp_success is called and on failure dhcp_failure is called. The service state transition to Ready is done in dhcp_success when the function  __connman_ipconfig_gateway_add is called. In case of failure dhcp_failure is called which in turn calls __connman_ipconfig_gateway_remove but we do not do a state transition back to configuration.

I have made this change and would send a patch to you for review. Code works fine. Service goes to configuration from online and again goes to ready once IPV4LL is assigned.