Updated connman to version 1.35
[platform/upstream/connman.git] / src / config.c
old mode 100644 (file)
new mode 100755 (executable)
index a8c3da8..75cd717
@@ -740,6 +740,9 @@ static bool load_service(GKeyFile *keyfile, const char *group,
 
                if (str) {
                        if (security == CONNMAN_SERVICE_SECURITY_PSK ||
+#if defined TIZEN_EXT
+                           security == CONNMAN_SERVICE_SECURITY_RSN ||
+#endif
                                        security == CONNMAN_SERVICE_SECURITY_WEP) {
                                service->security = security;
                        } else {
@@ -755,14 +758,14 @@ static bool load_service(GKeyFile *keyfile, const char *group,
                        service->security = CONNMAN_SERVICE_SECURITY_PSK;
        } else if (str) {
 
-               if (security != CONNMAN_SERVICE_SECURITY_NONE)
+               if (security != CONNMAN_SERVICE_SECURITY_NONE) {
                        connman_info("Mismatch no security and "
                                        "setting %s = %s",
                                        SERVICE_KEY_SECURITY, str);
-
-               service->security = CONNMAN_SERVICE_SECURITY_NONE;
+               }
+                       service->security = CONNMAN_SERVICE_SECURITY_NONE;
        } else
-               service->security = CONNMAN_SERVICE_SECURITY_NONE;
+                       service->security = CONNMAN_SERVICE_SECURITY_NONE;
 
        g_free(str);
 
@@ -1154,6 +1157,10 @@ static void provision_service_wifi(struct connman_config_service *config,
 
        if (config->phase2)
                __connman_service_set_string(service, "Phase2", config->phase2);
+#if defined TIZEN_EXT
+       else
+               __connman_service_set_string(service, "Phase2", NULL);
+#endif
 
        if (config->passphrase)
                __connman_service_set_string(service, "Passphrase",
@@ -1181,6 +1188,20 @@ static gboolean remove_virtual_config(gpointer user_data)
        return FALSE;
 }
 
+#if defined TIZEN_EXT
+static bool __check_address_type(int address_family, const char *address)
+{
+       unsigned char buf[sizeof(struct in6_addr)] = {0, };
+       int err = 0;
+
+       err = inet_pton(address_family, address, buf);
+       if(err > 0)
+               return TRUE;
+
+       return FALSE;
+}
+#endif
+
 static int try_provision_service(struct connman_config_service *config,
                                struct connman_service *service)
 {
@@ -1189,7 +1210,6 @@ static int try_provision_service(struct connman_config_service *config,
        enum connman_service_type type;
        const void *ssid;
        unsigned int ssid_len;
-       const char *str;
 
        network = __connman_service_get_network(service);
        if (!network) {
@@ -1220,10 +1240,6 @@ static int try_provision_service(struct connman_config_service *config,
                if (memcmp(config->ssid, ssid, ssid_len))
                        return -ENOENT;
 
-               str = connman_network_get_string(network, "WiFi.Security");
-               if (config->security != __connman_service_string2security(str))
-                       return -ENOENT;
-
                break;
 
        case CONNMAN_SERVICE_TYPE_ETHERNET:
@@ -1368,8 +1384,19 @@ static int try_provision_service(struct connman_config_service *config,
                __connman_service_nameserver_clear(service);
 
                for (i = 0; config->nameservers[i]; i++) {
+#if defined TIZEN_EXT
+                       if (__check_address_type(AF_INET, config->nameservers[i]))
+                               __connman_service_nameserver_append(service,
+                                               config->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+                       else if (__check_address_type(AF_INET6, config->nameservers[i]))
+                               __connman_service_nameserver_append(service,
+                                               config->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                        __connman_service_nameserver_append(service,
                                                config->nameservers[i], false);
+#endif
                }
        }
 
@@ -1465,6 +1492,13 @@ int __connman_config_provision_service(struct connman_service *service)
                        type != CONNMAN_SERVICE_TYPE_GADGET)
                return -ENOSYS;
 
+#if defined TIZEN_EXT
+       if(type == CONNMAN_SERVICE_TYPE_WIFI &&
+                       __connman_service_get_security(service) ==
+                       CONNMAN_SERVICE_SECURITY_NONE)
+               return -ENOSYS;
+#endif
+
        return find_and_provision_service(service);
 }