service: IPv6 autoconf will change the service state
authorJukka Rissanen <jukka.rissanen@nokia.com>
Thu, 10 Feb 2011 15:52:17 +0000 (17:52 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 11 Feb 2011 11:26:42 +0000 (12:26 +0100)
src/service.c

index 5db3baee66803af13d36ae17dc0ebb07c5a5aa80..1b8e42a7efb3c4506c731db644b6783611d5331c 100644 (file)
@@ -4123,18 +4123,46 @@ static void service_lower_down(struct connman_ipconfig *ipconfig)
 static void service_ip_bound(struct connman_ipconfig *ipconfig)
 {
        struct connman_service *service = connman_ipconfig_get_data(ipconfig);
+       enum connman_ipconfig_method method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
+       enum connman_ipconfig_type type = CONNMAN_IPCONFIG_TYPE_UNKNOWN;
 
        connman_info("%s ip bound", connman_ipconfig_get_ifname(ipconfig));
 
+       type = __connman_ipconfig_get_config_type(ipconfig);
+       method = __connman_ipconfig_get_method(ipconfig);
+
+       DBG("service %p ipconfig %p type %d method %d", service, ipconfig,
+                                                       type, method);
+
+       if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
+                       method == CONNMAN_IPCONFIG_METHOD_AUTO)
+               __connman_service_indicate_state(service,
+                                               CONNMAN_SERVICE_STATE_READY,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+
        settings_changed(service);
 }
 
 static void service_ip_release(struct connman_ipconfig *ipconfig)
 {
        struct connman_service *service = connman_ipconfig_get_data(ipconfig);
+       enum connman_ipconfig_method method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
+       enum connman_ipconfig_type type = CONNMAN_IPCONFIG_TYPE_UNKNOWN;
 
        connman_info("%s ip release", connman_ipconfig_get_ifname(ipconfig));
 
+       type = __connman_ipconfig_get_config_type(ipconfig);
+       method = __connman_ipconfig_get_method(ipconfig);
+
+       DBG("service %p ipconfig %p type %d method %d", service, ipconfig,
+                                                       type, method);
+
+       if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
+                       method == CONNMAN_IPCONFIG_METHOD_OFF)
+               __connman_service_indicate_state(service,
+                                       CONNMAN_SERVICE_STATE_DISCONNECT,
+                                       CONNMAN_IPCONFIG_TYPE_IPV6);
+
        settings_changed(service);
 }