dhcpv6: Do not start release if we are not connected
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 18 Jan 2012 13:25:02 +0000 (15:25 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 20 Jan 2012 00:35:24 +0000 (01:35 +0100)
We do not need to start the RELEASE procedure if we have not
yet contacted the server.

src/dhcpv6.c

index e629066..aab5868 100644 (file)
@@ -888,6 +888,16 @@ int __connman_dhcpv6_start_release(struct connman_network *network,
        }
 
        dhcp_client = dhcp->dhcp_client;
+       if (dhcp_client == NULL) {
+               /*
+                * We had started the DHCPv6 handshaking i.e., we have called
+                * __connman_dhcpv6_start() but it has not yet sent
+                * a solicitation message to server. This means that we do not
+                * have DHCPv6 configured yet so we can just quit here.
+                */
+               DBG("DHCPv6 was not started");
+               return 0;
+       }
 
        g_dhcp_client_clear_requests(dhcp_client);
        g_dhcp_client_clear_values(dhcp_client);