network: Let the gateway code handle the READY transition
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Jul 2011 09:33:18 +0000 (11:33 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 8 Jul 2011 09:33:18 +0000 (11:33 +0200)
For IPv4 (DHCP, fixed or manual), and for manual IPv6, the gateway handling
code (connection.c) is the one responsible for moving to the READY state.

src/connection.c
src/network.c

index a6ac462..4f3b3f8 100644 (file)
@@ -24,6 +24,7 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
 #include <string.h>
 #include <net/if.h>
 
@@ -455,7 +456,7 @@ int __connman_connection_gateway_add(struct connman_service *service,
        active_gateway = find_active_gateway();
        new_gateway = add_gateway(service, index, gateway, type);
        if (new_gateway == NULL)
-               return 0;
+               return -EINVAL;
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
                        new_gateway->ipv6_gateway != NULL &&
index 6708c2a..784f67c 100644 (file)
@@ -832,10 +832,6 @@ static void dhcp_success(struct connman_network *network)
        if (err < 0)
                goto err;
 
-       __connman_service_ipconfig_indicate_state(service,
-                                       CONNMAN_SERVICE_STATE_READY,
-                                       CONNMAN_IPCONFIG_TYPE_IPV4);
-
        return;
 
 err:
@@ -893,10 +889,6 @@ static int set_connected_fixed(struct connman_network *network)
        if (err < 0)
                goto err;
 
-       __connman_service_ipconfig_indicate_state(service,
-                                       CONNMAN_SERVICE_STATE_READY,
-                                       CONNMAN_IPCONFIG_TYPE_IPV4);
-
        return 0;
 
 err:
@@ -932,10 +924,6 @@ static void set_connected_manual(struct connman_network *network)
 
        connman_network_set_associating(network, FALSE);
 
-       __connman_service_ipconfig_indicate_state(service,
-                                       CONNMAN_SERVICE_STATE_READY,
-                                       CONNMAN_IPCONFIG_TYPE_IPV4);
-
        return;
 
 err:
@@ -995,10 +983,6 @@ static int manual_ipv6_set(struct connman_network *network,
 
        network->connecting = FALSE;
 
-       __connman_service_ipconfig_indicate_state(service,
-                                       CONNMAN_SERVICE_STATE_READY,
-                                       CONNMAN_IPCONFIG_TYPE_IPV6);
-
        return 0;
 }
 
@@ -1286,13 +1270,7 @@ static int manual_ipv4_set(struct connman_network *network,
                return err;
        }
 
-       __connman_ipconfig_gateway_add(ipconfig);
-
-       __connman_service_ipconfig_indicate_state(service,
-                                       CONNMAN_SERVICE_STATE_READY,
-                                       CONNMAN_IPCONFIG_TYPE_IPV4);
-
-       return 0;
+       return __connman_ipconfig_gateway_add(ipconfig);
 }
 
 int __connman_network_clear_ipconfig(struct connman_network *network,