Added support of WPA3-SAE security mode.
[platform/upstream/connman.git] / src / service.c
old mode 100755 (executable)
new mode 100644 (file)
index f561170..d1ada48
@@ -58,6 +58,10 @@ static unsigned int vpn_autoconnect_timeout = 0;
 static struct connman_service *current_default = NULL;
 static bool services_dirty = false;
 
+#if defined TIZEN_EXT
+static bool auto_connect_mode = TRUE;
+#endif
+
 struct connman_stats {
        bool valid;
        bool enabled;
@@ -77,14 +81,6 @@ struct connman_service_user {
        uid_t current_user;
 };
 
-#ifdef TIZEN_EXT
-enum connman_dnsconfig_method {
-       CONNMAN_DNSCONFIG_METHOD_UNKNOWN = 0,
-       CONNMAN_DNSCONFIG_METHOD_MANUAL  = 1,
-       CONNMAN_DNSCONFIG_METHOD_DHCP    = 2,
-};
-#endif
-
 struct connman_service {
        int refcount;
        char *identifier;
@@ -116,6 +112,7 @@ struct connman_service {
        char **nameservers;
        char **nameservers_config;
        char **nameservers_auto;
+       int nameservers_timeout;
        char **domains;
        char *hostname;
        char *domainname;
@@ -124,8 +121,13 @@ struct connman_service {
        /* 802.1x settings from the config files */
        char *eap;
        char *identity;
+       char *anonymous_identity;
        char *agent_identity;
        char *ca_cert_file;
+       char *subject_match;
+       char *altsubject_match;
+       char *domain_suffix_match;
+       char *domain_match;
        char *client_cert_file;
        char *private_key_file;
        char *private_key_passphrase;
@@ -164,9 +166,15 @@ struct connman_service {
         */
        char *keymgmt_type;
        int disconnect_reason;
+       int assoc_status_code;
+       /*
+        * Only for EAP-FAST
+        */
+       char *phase1;
 #endif
 #ifdef TIZEN_EXT
-       enum connman_dnsconfig_method dns_config_method;
+       enum connman_dnsconfig_method dns_config_method_ipv4;
+       enum connman_dnsconfig_method dns_config_method_ipv6;
 #endif
 };
 
@@ -176,7 +184,7 @@ static struct connman_ipconfig *create_ip4config(struct connman_service *service
                int index, enum connman_ipconfig_method method);
 static struct connman_ipconfig *create_ip6config(struct connman_service *service,
                int index);
-
+static void dns_changed(struct connman_service *service);
 
 struct find_data {
        const char *path;
@@ -290,6 +298,10 @@ const char *__connman_service_type2string(enum connman_service_type type)
                return "gadget";
        case CONNMAN_SERVICE_TYPE_P2P:
                return "p2p";
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+               return "mesh";
+#endif
        }
 
        return NULL;
@@ -329,15 +341,17 @@ enum connman_service_security __connman_service_string2security(const char *str)
 
        if (!strcmp(str, "psk"))
                return CONNMAN_SERVICE_SECURITY_PSK;
-       if (!strcmp(str, "ieee8021x"))
+       if (!strcmp(str, "ieee8021x") || !strcmp(str, "8021x"))
                return CONNMAN_SERVICE_SECURITY_8021X;
-       if (!strcmp(str, "none"))
+       if (!strcmp(str, "none") || !strcmp(str, "open"))
                return CONNMAN_SERVICE_SECURITY_NONE;
        if (!strcmp(str, "wep"))
                return CONNMAN_SERVICE_SECURITY_WEP;
 #if defined TIZEN_EXT
        if (!strcmp(str, "rsn"))
                return CONNMAN_SERVICE_SECURITY_RSN;
+       if (!strcmp(str, "sae"))
+               return CONNMAN_SERVICE_SECURITY_SAE;
 #endif
 
        return CONNMAN_SERVICE_SECURITY_UNKNOWN;
@@ -358,6 +372,8 @@ static const char *security2string(enum connman_service_security security)
                return "psk";
        case CONNMAN_SERVICE_SECURITY_RSN:
                return "rsn";
+       case CONNMAN_SERVICE_SECURITY_SAE:
+               return "sae";
 #else
        case CONNMAN_SERVICE_SECURITY_RSN:
                return "psk";
@@ -557,6 +573,19 @@ static bool is_service_owner_user_login(struct connman_service *service)
 #endif
 }
 
+static void set_split_routing(struct connman_service *service, bool value)
+{
+       if (service->type != CONNMAN_SERVICE_TYPE_VPN)
+               return;
+
+       service->do_split_routing = value;
+
+       if (service->do_split_routing)
+               service->order = 0;
+       else
+               service->order = 10;
+}
+
 int __connman_service_load_modifiable(struct connman_service *service)
 {
        GKeyFile *keyfile;
@@ -575,10 +604,15 @@ int __connman_service_load_modifiable(struct connman_service *service)
        case CONNMAN_SERVICE_TYPE_SYSTEM:
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                break;
        case CONNMAN_SERVICE_TYPE_VPN:
-               service->do_split_routing = g_key_file_get_boolean(keyfile,
-                               service->identifier, "SplitRouting", NULL);
+               set_split_routing(service, g_key_file_get_boolean(keyfile,
+                                                       service->identifier,
+                                                       "SplitRouting", NULL));
+
                /* fall through */
        case CONNMAN_SERVICE_TYPE_WIFI:
        case CONNMAN_SERVICE_TYPE_GADGET:
@@ -619,6 +653,8 @@ static int service_load_passphrase(struct connman_service *service)
        if (str)
                service->passphrase = str;
 
+       g_key_file_free(keyfile);
+
        return 0;
 }
 
@@ -646,10 +682,15 @@ static int service_load(struct connman_service *service)
        case CONNMAN_SERVICE_TYPE_SYSTEM:
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                break;
        case CONNMAN_SERVICE_TYPE_VPN:
-               service->do_split_routing = g_key_file_get_boolean(keyfile,
-                               service->identifier, "SplitRouting", NULL);
+               set_split_routing(service, g_key_file_get_boolean(keyfile,
+                                                       service->identifier,
+                                                       "SplitRouting", NULL));
+
                autoconnect = g_key_file_get_boolean(keyfile,
                                service->identifier, "AutoConnect", &error);
                if (!error)
@@ -756,10 +797,19 @@ static int service_load(struct connman_service *service)
 
 #ifdef TIZEN_EXT
        char *dns_method;
-       if (TIZEN_TV_EXT) {
-               dns_method = g_key_file_get_string(keyfile, service->identifier,
-                               "Nameservers.method", NULL);
-               service->dns_config_method = __connman_dnsconfig_string2method(dns_method);
+
+       dns_method = g_key_file_get_string(keyfile, service->identifier,
+                       "Nameservers.IPv4method", NULL);
+       if (dns_method) {
+               service->dns_config_method_ipv4 = __connman_dnsconfig_string2method(dns_method);
+               g_free(dns_method);
+       }
+
+       dns_method = g_key_file_get_string(keyfile, service->identifier,
+                       "Nameservers.IPv6method", NULL);
+       if (dns_method) {
+               service->dns_config_method_ipv6 = __connman_dnsconfig_string2method(dns_method);
+               g_free(dns_method);
        }
 #endif
 
@@ -897,6 +947,9 @@ static int service_save(struct connman_service *service)
        case CONNMAN_SERVICE_TYPE_SYSTEM:
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                break;
        case CONNMAN_SERVICE_TYPE_VPN:
                g_key_file_set_boolean(keyfile, service->identifier,
@@ -999,18 +1052,26 @@ static int service_save(struct connman_service *service)
        g_key_file_remove_key(keyfile, service->identifier,
                                                        "Nameservers", NULL);
 
-#ifdef TIZEN_EXT
-       if (TIZEN_TV_EXT) {
-               if(service->dns_config_method != 0) {
-                       const char *method;
-                       method = __connman_dnsconfig_method2string(
-                                       service->dns_config_method);
-                       g_key_file_set_string(keyfile, service->identifier,
-                                       "Nameservers.method", method);
-               } else
-               g_key_file_remove_key(keyfile, service->identifier,
-                                                       "Nameservers.method", NULL);
-       }
+#if defined TIZEN_EXT
+       if(service->dns_config_method_ipv4 != 0) {
+               const char *method;
+               method = __connman_dnsconfig_method2string(
+                               service->dns_config_method_ipv4);
+               g_key_file_set_string(keyfile, service->identifier,
+                               "Nameservers.IPv4method", method);
+       } else
+       g_key_file_remove_key(keyfile, service->identifier,
+                                               "Nameservers.IPv4method", NULL);
+
+       if(service->dns_config_method_ipv6 != 0) {
+               const char *method;
+               method = __connman_dnsconfig_method2string(
+                               service->dns_config_method_ipv6);
+               g_key_file_set_string(keyfile, service->identifier,
+                               "Nameservers.IPv6method", method);
+       } else
+       g_key_file_remove_key(keyfile, service->identifier,
+                                                       "Nameservers.IPv6method", NULL);
 #endif
 
        if (service->timeservers_config) {
@@ -1235,15 +1296,12 @@ done:
        return result;
 }
 
-static bool is_connecting_state(struct connman_service *service,
-                                       enum connman_service_state state)
+static bool is_connecting(enum connman_service_state state)
 {
        switch (state) {
        case CONNMAN_SERVICE_STATE_UNKNOWN:
        case CONNMAN_SERVICE_STATE_IDLE:
        case CONNMAN_SERVICE_STATE_FAILURE:
-               if (service->network)
-                       return connman_network_get_connecting(service->network);
        case CONNMAN_SERVICE_STATE_DISCONNECT:
        case CONNMAN_SERVICE_STATE_READY:
        case CONNMAN_SERVICE_STATE_ONLINE:
@@ -1256,8 +1314,7 @@ static bool is_connecting_state(struct connman_service *service,
        return false;
 }
 
-static bool is_connected_state(const struct connman_service *service,
-                                       enum connman_service_state state)
+static bool is_connected(enum connman_service_state state)
 {
        switch (state) {
        case CONNMAN_SERVICE_STATE_UNKNOWN:
@@ -1275,105 +1332,296 @@ static bool is_connected_state(const struct connman_service *service,
        return false;
 }
 
-static bool is_idle_state(const struct connman_service *service,
-                               enum connman_service_state state)
+static bool is_idle(enum connman_service_state state)
 {
        switch (state) {
+       case CONNMAN_SERVICE_STATE_IDLE:
+       case CONNMAN_SERVICE_STATE_DISCONNECT:
+       case CONNMAN_SERVICE_STATE_FAILURE:
+               return true;
        case CONNMAN_SERVICE_STATE_UNKNOWN:
        case CONNMAN_SERVICE_STATE_ASSOCIATION:
        case CONNMAN_SERVICE_STATE_CONFIGURATION:
        case CONNMAN_SERVICE_STATE_READY:
        case CONNMAN_SERVICE_STATE_ONLINE:
-       case CONNMAN_SERVICE_STATE_DISCONNECT:
-       case CONNMAN_SERVICE_STATE_FAILURE:
                break;
-       case CONNMAN_SERVICE_STATE_IDLE:
-               return true;
        }
 
        return false;
 }
 
-static bool is_connecting(struct connman_service *service)
+static int nameservers_changed_cb(void *user_data)
 {
-       return is_connecting_state(service, service->state);
+       struct connman_service *service = user_data;
+
+       DBG("service %p", service);
+
+       service->nameservers_timeout = 0;
+       if ((is_idle(service->state) && !service->nameservers) ||
+                       is_connected(service->state))
+               dns_changed(service);
+
+       return FALSE;
 }
 
-static bool is_connected(struct connman_service *service)
+static void nameservers_changed(struct connman_service *service)
 {
-       return is_connected_state(service, service->state);
+       if (!service->nameservers_timeout)
+               service->nameservers_timeout = g_idle_add(nameservers_changed_cb,
+                                                       service);
 }
 
 static bool nameserver_available(struct connman_service *service,
+                               enum connman_ipconfig_type type,
                                const char *ns)
 {
        int family;
 
        family = connman_inet_check_ipaddress(ns);
 
-       if (family == AF_INET)
-               return is_connected_state(service, service->state_ipv4);
+       if (family == AF_INET) {
+               if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
+                       return false;
+
+               return is_connected(service->state_ipv4);
+       }
+
+       if (family == AF_INET6) {
+               if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
+                       return false;
 
-       if (family == AF_INET6)
-               return is_connected_state(service, service->state_ipv6);
+               return is_connected(service->state_ipv6);
+       }
 
        return false;
 }
 
+static int searchdomain_add_all(struct connman_service *service)
+{
+       int index, i = 0;
+
+       if (!is_connected(service->state))
+               return -ENOTCONN;
+
+       index = __connman_service_get_index(service);
+       if (index < 0)
+               return -ENXIO;
+
+       if (service->domains) {
+               while (service->domains[i]) {
+                       connman_resolver_append(index, service->domains[i],
+                                               NULL);
+                       i++;
+               }
+
+               return 0;
+       }
+
+       if (service->domainname)
+               connman_resolver_append(index, service->domainname, NULL);
+
+       return 0;
+
+}
+
+static int searchdomain_remove_all(struct connman_service *service)
+{
+       int index, i = 0;
+
+       if (!is_connected(service->state))
+               return -ENOTCONN;
+
+       index = __connman_service_get_index(service);
+       if (index < 0)
+               return -ENXIO;
+
+       while (service->domains && service->domains[i]) {
+               connman_resolver_remove(index, service->domains[i], NULL);
+               i++;
+       }
+
+       if (service->domainname)
+               connman_resolver_remove(index, service->domainname, NULL);
+
+       return 0;
+}
+
 static int nameserver_add(struct connman_service *service,
+                       enum connman_ipconfig_type type,
                        const char *nameserver)
 {
-       int index;
+       int index, ret;
 
-       if (!nameserver_available(service, nameserver))
+       if (!nameserver_available(service, type, nameserver))
                return 0;
 
        index = __connman_service_get_index(service);
        if (index < 0)
                return -ENXIO;
 
-       return connman_resolver_append(index, NULL, nameserver);
+#if defined TIZEN_EXT
+       DBG("Resolver append nameserver: %s", nameserver);
+#endif
+       ret = connman_resolver_append(index, NULL, nameserver);
+       if (ret >= 0)
+               nameservers_changed(service);
+
+       return ret;
 }
 
-static int nameserver_add_all(struct connman_service *service)
+static int nameserver_add_all(struct connman_service *service,
+                       enum connman_ipconfig_type type)
 {
        int i = 0;
 
        if (service->nameservers_config) {
                while (service->nameservers_config[i]) {
-                       nameserver_add(service, service->nameservers_config[i]);
+#if defined TIZEN_EXT
+                       DBG("type %d add service->nameservers_config[%d]:%s",type,
+                           i, service->nameservers_config[i]);
+                       if(strncmp(service->nameservers_config[i], "::", 2) == 0) {
+                               DBG("Invalid nameserver");
+                               i++;
+                               continue;
+                       }
+
+                       switch(type) {
+                       case CONNMAN_IPCONFIG_TYPE_IPV4:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers_config[i]) == AF_INET &&
+                                   service->dns_config_method_ipv4 ==
+                                   CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers_config[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_IPV6:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers_config[i]) == AF_INET6 &&
+                                   service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers_config[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_ALL:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers_config[i]) == AF_INET &&
+                                   service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers_config[i]);
+                               }
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers_config[i]) == AF_INET6 &&
+                                   service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers_config[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+                               DBG("CONNMAN_IPCONFIG_TYPE_UNKNOWN do nothing");
+                               break;
+                       default:
+                               DBG("default case do nothing");
+                               break;
+                       }
+#else
+                       nameserver_add(service, type,
+                               service->nameservers_config[i]);
+#endif
                        i++;
                }
-
-               return 0;
-       }
-
-       if (service->nameservers) {
+       } else if (service->nameservers) {
                while (service->nameservers[i]) {
-                       nameserver_add(service, service->nameservers[i]);
+#if defined TIZEN_EXT
+                       DBG("type %d service->nameservers[%d]: %s",type,
+                           i, service->nameservers[i]);
+
+                       switch(type) {
+                       case CONNMAN_IPCONFIG_TYPE_IPV4:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_IPV6:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_ALL:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers[i]);
+                               }
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       nameserver_add(service, type,
+                                                      service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+                               DBG("CONNMAN_IPCONFIG_TYPE_UNKNOWN do nothing");
+                               break;
+                       default:
+                               DBG("default case do nothing");
+                               break;
+                       }
+#else
+                       nameserver_add(service, type,
+                               service->nameservers[i]);
+#endif
                        i++;
                }
        }
 
+       if (!i)
+               __connman_resolver_append_fallback_nameservers();
+
+       searchdomain_add_all(service);
+
        return 0;
 }
 
 static int nameserver_remove(struct connman_service *service,
+                       enum connman_ipconfig_type type,
                        const char *nameserver)
 {
-       int index;
+       int index, ret;
 
-       if (!nameserver_available(service, nameserver))
+       if (!nameserver_available(service, type, nameserver))
                return 0;
 
        index = __connman_service_get_index(service);
        if (index < 0)
                return -ENXIO;
 
-       return connman_resolver_remove(index, NULL, nameserver);
+#if defined TIZEN_EXT
+       DBG("Resolver remove nameserver: %s", nameserver);
+#endif
+       ret = connman_resolver_remove(index, NULL, nameserver);
+       if (ret >= 0)
+               nameservers_changed(service);
+
+       return ret;
 }
 
-static int nameserver_remove_all(struct connman_service *service)
+static int nameserver_remove_all(struct connman_service *service,
+                               enum connman_ipconfig_type type)
 {
 #if defined TIZEN_EXT
        /**
@@ -1391,66 +1639,128 @@ static int nameserver_remove_all(struct connman_service *service)
                return -ENXIO;
 
        while (service->nameservers_config && service->nameservers_config[i]) {
-
-               nameserver_remove(service, service->nameservers_config[i]);
+#if defined TIZEN_EXT
+               DBG("type %d Remove service->nameservers_config[%d]: %s",
+                     type, i, service->nameservers_config[i]);
+               switch(type) {
+               case CONNMAN_IPCONFIG_TYPE_IPV4:
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET &&
+                               (service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP ||
+                               service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL)) {
+                               nameserver_remove(service, type,
+                                                 service->nameservers_config[i]);
+                       }
+                       break;
+               case CONNMAN_IPCONFIG_TYPE_IPV6:
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET6 &&
+                               (service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP ||
+                               service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL)) {
+                               nameserver_remove(service, type,
+                                                 service->nameservers_config[i]);
+                       }
+                       break;
+               case CONNMAN_IPCONFIG_TYPE_ALL:
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET &&
+                               (service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP ||
+                               service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL)) {
+                               nameserver_remove(service, type,
+                                                 service->nameservers_config[i]);
+                       }
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET6 &&
+                               (service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP ||
+                               service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL)) {
+                               nameserver_remove(service, type,
+                                                 service->nameservers_config[i]);
+                       }
+                       break;
+               case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+                       DBG("CONNMAN_IPCONFIG_TYPE_UNKNOWN do nothing");
+                       break;
+               default:
+                       DBG("default case do nothing");
+                       break;
+               }
+#else
+               nameserver_remove(service, type,
+                               service->nameservers_config[i]);
+#endif
                i++;
        }
 
        i = 0;
        while (service->nameservers && service->nameservers[i]) {
-               nameserver_remove(service, service->nameservers[i]);
-               i++;
-       }
-
-       return 0;
-}
-
-static int searchdomain_add_all(struct connman_service *service)
-{
-       int index, i = 0;
-
-       if (!is_connected(service))
-               return -ENOTCONN;
-
-       index = __connman_service_get_index(service);
-       if (index < 0)
-               return -ENXIO;
-
-       if (service->domains) {
-               while (service->domains[i]) {
-                       connman_resolver_append(index, service->domains[i],
-                                               NULL);
-                       i++;
+#if defined TIZEN_EXT
+               DBG("type %d Remove service->nameservers[%d]: %s",type, i,
+                     service->nameservers[i]);
+               switch(type) {
+                       case CONNMAN_IPCONFIG_TYPE_IPV4:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       (service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_MANUAL ||
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP)) {
+                                       nameserver_remove(service, type,
+                                                         service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_IPV6:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       (service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_MANUAL ||
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP)) {
+                                       nameserver_remove(service, type,
+                                                         service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_ALL:
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       (service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_MANUAL ||
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP)) {
+                                       nameserver_remove(service, type,
+                                                         service->nameservers[i]);
+                               }
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       (service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_MANUAL ||
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP)) {
+                                       nameserver_remove(service, type,
+                                                         service->nameservers[i]);
+                               }
+                               break;
+                       case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+                               DBG("CONNMAN_IPCONFIG_TYPE_UNKNOWN do nothing");
+                               break;
+                       default:
+                               DBG("default case do nothing");
+                               break;
                }
-
-               return 0;
-       }
-
-       if (service->domainname)
-               connman_resolver_append(index, service->domainname, NULL);
-
-       return 0;
-
-}
-
-static int searchdomain_remove_all(struct connman_service *service)
-{
-       int index, i = 0;
-
-       if (!is_connected(service))
-               return -ENOTCONN;
-
-       index = __connman_service_get_index(service);
-       if (index < 0)
-               return -ENXIO;
-
-       while (service->domains && service->domains[i]) {
-               connman_resolver_remove(index, service->domains[i], NULL);
+#else
+               nameserver_remove(service, type, service->nameservers[i]);
+#endif
                i++;
        }
 
-       if (service->domainname)
-               connman_resolver_remove(index, service->domainname, NULL);
+       searchdomain_remove_all(service);
 
        return 0;
 }
@@ -1460,13 +1770,19 @@ static int searchdomain_remove_all(struct connman_service *service)
  * inserted to resolver via netlink message (see rtnl.c:rtnl_newnduseropt()
  * for details) and not through service.c
  */
+#if defined TIZEN_EXT
+int __connman_service_nameserver_append(struct connman_service *service,
+                               const char *nameserver, bool is_auto,
+                               enum connman_ipconfig_type type)
+#else
 int __connman_service_nameserver_append(struct connman_service *service,
                                const char *nameserver, bool is_auto)
+#endif
 {
        char **nameservers;
        int len, i;
 
-       DBG("service %p nameserver %s auto %d", service, nameserver, is_auto);
+       DBG("service %p nameserver %s auto %d", service, nameserver, is_auto);
 
        if (!nameserver)
                return -EINVAL;
@@ -1477,8 +1793,15 @@ int __connman_service_nameserver_append(struct connman_service *service,
                nameservers = service->nameservers;
 
        for (i = 0; nameservers && nameservers[i]; i++)
+#if defined TIZEN_EXT
+       {
+               DBG("nameservers[%d] %s, nameserver %s", i, nameservers[i], nameserver);
+#endif
                if (g_strcmp0(nameservers[i], nameserver) == 0)
                        return -EEXIST;
+#if defined TIZEN_EXT
+       }
+#endif
 
        if (nameservers) {
                len = g_strv_length(nameservers);
@@ -1492,29 +1815,40 @@ int __connman_service_nameserver_append(struct connman_service *service,
                return -ENOMEM;
 
        nameservers[len] = g_strdup(nameserver);
-       if (!nameservers[len])
-               return -ENOMEM;
-
        nameservers[len + 1] = NULL;
 
 #ifdef TIZEN_EXT
-       if(TIZEN_TV_EXT &&
-          service->dns_config_method == CONNMAN_DNSCONFIG_METHOD_UNKNOWN)
-               service->dns_config_method = CONNMAN_DNSCONFIG_METHOD_DHCP;
+       if(type == CONNMAN_IPCONFIG_TYPE_IPV4 &&
+          service->dns_config_method_ipv4 == CONNMAN_DNSCONFIG_METHOD_UNKNOWN)
+               service->dns_config_method_ipv4 = CONNMAN_DNSCONFIG_METHOD_DHCP;
+
+       if(type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
+          service->dns_config_method_ipv6 == CONNMAN_DNSCONFIG_METHOD_UNKNOWN)
+               service->dns_config_method_ipv6 = CONNMAN_DNSCONFIG_METHOD_DHCP;
 #endif
 
        if (is_auto) {
                service->nameservers_auto = nameservers;
        } else {
                service->nameservers = nameservers;
-               nameserver_add(service, nameserver);
+               nameserver_add(service, CONNMAN_IPCONFIG_TYPE_ALL, nameserver);
        }
 
+       nameservers_changed(service);
+
+       searchdomain_add_all(service);
+
        return 0;
 }
 
+#if defined TIZEN_EXT
+int __connman_service_nameserver_remove(struct connman_service *service,
+                               const char *nameserver, bool is_auto,
+                               enum connman_ipconfig_type type)
+#else
 int __connman_service_nameserver_remove(struct connman_service *service,
                                const char *nameserver, bool is_auto)
+#endif
 {
        char **servers, **nameservers;
        bool found = false;
@@ -1533,7 +1867,7 @@ int __connman_service_nameserver_remove(struct connman_service *service,
        if (!nameservers)
                return 0;
 
-       for (i = 0; nameservers && nameservers[i]; i++)
+       for (i = 0; nameservers[i]; i++)
                if (g_strcmp0(nameservers[i], nameserver) == 0) {
                        found = true;
                        break;
@@ -1572,7 +1906,14 @@ set_servers:
                service->nameservers_auto = nameservers;
        } else {
                service->nameservers = nameservers;
-               nameserver_remove(service, nameserver);
+#if defined TIZEN_EXT
+               DBG("nameserver remove ip_type: %d", type);
+               nameserver_remove(service, type,
+                               nameserver);
+#else
+               nameserver_remove(service, CONNMAN_IPCONFIG_TYPE_ALL,
+                               nameserver);
+#endif
        }
 
        return 0;
@@ -1580,12 +1921,12 @@ set_servers:
 
 void __connman_service_nameserver_clear(struct connman_service *service)
 {
-       nameserver_remove_all(service);
+       nameserver_remove_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
 
        g_strfreev(service->nameservers);
        service->nameservers = NULL;
 
-       nameserver_add_all(service);
+       nameserver_add_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
 }
 
 static void add_nameserver_route(int family, int index, char *nameserver,
@@ -1698,6 +2039,18 @@ void __connman_service_nameserver_del_routes(struct connman_service *service,
                nameserver_del_routes(index, service->nameservers, type);
 }
 
+static void address_updated(struct connman_service *service,
+                       enum connman_ipconfig_type type)
+{
+       if (is_connected(service->state) &&
+                       service == __connman_service_get_default()) {
+               nameserver_remove_all(service, type);
+               nameserver_add_all(service, type);
+
+               __connman_timeserver_sync(service);
+       }
+}
+
 static struct connman_stats *stats_get(struct connman_service *service)
 {
        if (service->roaming)
@@ -1826,22 +2179,27 @@ struct connman_service *connman_service_get_default_connection(void)
                                state2string(service->state),
                                __connman_service_type2string(service->type));
 
+#if defined TIZEN_MAINTAIN_ONLINE
+               if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
+                               service->state == CONNMAN_SERVICE_STATE_ONLINE) {
+#else
                if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
-                               is_connected(service) == TRUE) {
+                               is_connected(service->state) == TRUE) {
+#endif
                        return service;
                } else if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR &&
                                __connman_service_is_internet_profile(service) == TRUE) {
                        if (default_service == NULL)
                                default_service = service;
-                       else if (is_connected(service) == TRUE &&
-                                       is_connected(default_service) == FALSE)
+                       else if (is_connected(service->state) == TRUE &&
+                                       is_connected(default_service->state) == FALSE)
                                default_service = service;
                } else if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET &&
-                               is_connected(service) == TRUE) {
+                               is_connected(service->state) == TRUE) {
                        if (default_service == NULL)
                                default_service = service;
                } else if (service->type == CONNMAN_SERVICE_TYPE_BLUETOOTH &&
-                               is_connected(service) == TRUE) {
+                               is_connected(service->state) == TRUE) {
                        if (default_service == NULL)
                                default_service = service;
                }
@@ -1853,6 +2211,9 @@ struct connman_service *connman_service_get_default_connection(void)
 
 struct connman_service *__connman_service_get_default(void)
 {
+#if defined TIZEN_MAINTAIN_ONLINE
+       return connman_service_get_default_connection();
+#else
        struct connman_service *service;
 
        if (!service_list)
@@ -1860,10 +2221,11 @@ struct connman_service *__connman_service_get_default(void)
 
        service = service_list->data;
 
-       if (!is_connected(service))
+       if (!is_connected(service->state))
                return NULL;
 
        return service;
+#endif
 }
 
 bool __connman_service_index_is_default(int index)
@@ -1925,7 +2287,9 @@ static void state_changed(struct connman_service *service)
        if (!allow_property_changed(service))
                return;
 #endif
-
+#if defined TIZEN_EXT
+       DBG(" %s, %s", str, service->path);
+#endif
        connman_dbus_property_changed_basic(service->path,
                                CONNMAN_SERVICE_INTERFACE, "State",
                                                DBUS_TYPE_STRING, &str);
@@ -2028,6 +2392,9 @@ static void append_security(DBusMessageIter *iter, void *user_data)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        str = "wps";
                        dbus_message_iter_append_basic(iter,
                                                DBUS_TYPE_STRING, &str);
@@ -2057,7 +2424,7 @@ static void append_ipv4(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
-       if (!is_connected_state(service, service->state_ipv4))
+       if (!is_connected(service->state_ipv4))
                return;
 
        if (service->ipconfig_ipv4)
@@ -2068,7 +2435,7 @@ static void append_ipv6(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
-       if (!is_connected_state(service, service->state_ipv6))
+       if (!is_connected(service->state_ipv6))
                return;
 
        if (service->ipconfig_ipv6)
@@ -2102,9 +2469,9 @@ static void append_nameservers(DBusMessageIter *iter,
 
        for (i = 0; servers[i]; i++) {
                if (service)
-                       available = nameserver_available(service, servers[i]);
-
-               DBG("servers[%d] %s available %d", i, servers[i], available);
+                       available = nameserver_available(service,
+                                               CONNMAN_IPCONFIG_TYPE_ALL,
+                                               servers[i]);
 
                if (available)
                        dbus_message_iter_append_basic(iter,
@@ -2112,31 +2479,143 @@ static void append_nameservers(DBusMessageIter *iter,
        }
 }
 
+#if defined TIZEN_EXT
+static void append_nameserver_manual(DBusMessageIter *iter,
+               struct connman_service *service, const char *server)
+{
+       bool available = true;
+
+       if (service)
+               available = nameserver_available(service,
+                               CONNMAN_IPCONFIG_TYPE_ALL, server);
+
+       if (available)
+               dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &server);
+}
+
+static void append_nameserver_dhcp(DBusMessageIter *iter,
+               struct connman_service *service, const char *server)
+{
+       bool available = true;
+
+       if (service)
+               available = nameserver_available(service,
+                               CONNMAN_IPCONFIG_TYPE_ALL, server);
+
+       if (available)
+               dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &server);
+}
+#endif
+
 static void append_dns(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
+#if defined TIZEN_EXT
+       int i;
+#endif
 
-       if (!is_connected(service))
+       if (!is_connected(service->state))
                return;
 
 #ifdef TIZEN_EXT
        const char *str;
-       if (TIZEN_TV_EXT) {
-               /* Append DNS Config Type */
-               str = __connman_dnsconfig_method2string(service->dns_config_method);
-               if(str != NULL)
-                       dbus_message_iter_append_basic(iter,
-                               DBUS_TYPE_STRING, &str);
+
+       str = __connman_dnsconfig_method2string(service->dns_config_method_ipv4);
+       if(str != NULL) {
+               char *str1 = g_strdup_printf("ipv4.%s", str);
+               dbus_message_iter_append_basic(iter,
+                       DBUS_TYPE_STRING, &str1);
+               g_free(str1);
+       }
+
+       str = __connman_dnsconfig_method2string(service->dns_config_method_ipv6);
+       if(str != NULL) {
+               char *str1 = g_strdup_printf("ipv6.%s", str);
+               dbus_message_iter_append_basic(iter,
+                       DBUS_TYPE_STRING, &str1);
+               g_free(str1);
        }
 #endif
 
        if (service->nameservers_config) {
+#if defined TIZEN_EXT
+               i = 0;
+               while (service->nameservers_config[i]) {
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET &&
+                               service->dns_config_method_ipv4 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                               append_nameserver_manual(iter, service,
+                                               service->nameservers_config[i]);
+                       }
+
+                       if (connman_inet_check_ipaddress(
+                               service->nameservers_config[i]) == AF_INET6 &&
+                               service->dns_config_method_ipv6 ==
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                               append_nameserver_manual(iter, service,
+                                               service->nameservers_config[i]);
+                       }
+                       i++;
+               }
+               /* In case of mixed DNS Config Type one of IPv4/IPv6 can be
+                * dynamic while other is static so try to append the DNS
+                * Address which is dynamic also */
+               if (service->nameservers != NULL) {
+                       i = 0;
+                       while (service->nameservers[i]) {
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       append_nameserver_dhcp(iter, service,
+                                                       service->nameservers[i]);
+                               }
+
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       append_nameserver_dhcp(iter, service,
+                                                       service->nameservers[i]);
+                               }
+                               i++;
+                       }
+               }
+#else
                append_nameservers(iter, service, service->nameservers_config);
+#endif
                return;
        } else {
                if (service->nameservers)
+#if defined TIZEN_EXT
+               {
+                       i = 0;
+                       while (service->nameservers[i]) {
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET &&
+                                       service->dns_config_method_ipv4 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       append_nameserver_dhcp(iter, service,
+                                                       service->nameservers[i]);
+                               }
+
+                               if (connman_inet_check_ipaddress(
+                                       service->nameservers[i]) == AF_INET6 &&
+                                       service->dns_config_method_ipv6 ==
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       append_nameserver_dhcp(iter, service,
+                                                       service->nameservers[i]);
+                               }
+                               i++;
+                       }
+               }
+#else
                        append_nameservers(iter, service,
                                        service->nameservers);
+#endif
 
                if (service->nameservers_auto)
                        append_nameservers(iter, service,
@@ -2161,18 +2640,43 @@ static void append_dnsconfig(DBusMessageIter *iter, void *user_data)
 #ifdef TIZEN_EXT
        /* Append DNS Config Type */
        const char *str;
-       if (TIZEN_TV_EXT) {
-               str = __connman_dnsconfig_method2string(service->dns_config_method);
-               if(str != NULL)
-                       dbus_message_iter_append_basic(iter,
-                               DBUS_TYPE_STRING, &str);
+       str = __connman_dnsconfig_method2string(service->dns_config_method_ipv4);
+       if(str != NULL) {
+               char *str1 = g_strdup_printf("ipv4.%s", str);
+               dbus_message_iter_append_basic(iter,
+                       DBUS_TYPE_STRING, &str1);
+               g_free(str1);
+       }
+
+       str = __connman_dnsconfig_method2string(service->dns_config_method_ipv6);
+       if(str != NULL) {
+               char *str1 = g_strdup_printf("ipv6.%s", str);
+               dbus_message_iter_append_basic(iter,
+                       DBUS_TYPE_STRING, &str1);
+               g_free(str1);
        }
 #endif
 
        if (!service->nameservers_config)
                return;
 
+#if defined TIZEN_EXT
+       int i = 0;
+       while (service->nameservers_config[i]) {
+               if (connman_inet_check_ipaddress(service->nameservers_config[i]) == AF_INET &&
+                               service->dns_config_method_ipv4 == CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                       append_nameserver_manual(iter, NULL, service->nameservers_config[i]);
+               }
+
+               if (connman_inet_check_ipaddress(service->nameservers_config[i]) == AF_INET6 &&
+                               service->dns_config_method_ipv6 == CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                       append_nameserver_manual(iter, NULL, service->nameservers_config[i]);
+               }
+               i++;
+       }
+#else
        append_nameservers(iter, NULL, service->nameservers_config);
+#endif
 }
 
 static void append_ts(DBusMessageIter *iter, void *user_data)
@@ -2222,8 +2726,8 @@ static void append_domain(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
-       if (!is_connected(service) &&
-                               !is_connecting(service))
+       if (!is_connected(service->state) &&
+                               !is_connecting(service->state))
                return;
 
        if (service->domains)
@@ -2267,7 +2771,7 @@ static void append_proxy(DBusMessageIter *iter, void *user_data)
        const char *method = proxymethod2string(
                CONNMAN_SERVICE_PROXY_METHOD_DIRECT);
 
-       if (!is_connected(service))
+       if (!is_connected(service->state))
                return;
 
        proxy = connman_service_get_proxy_method(service);
@@ -2354,7 +2858,7 @@ static void append_provider(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
-       if (!is_connected(service))
+       if (!is_connected(service->state))
                return;
 
        if (service->provider)
@@ -2367,11 +2871,13 @@ static void settings_changed(struct connman_service *service,
 {
        enum connman_ipconfig_type type;
 
+       type = __connman_ipconfig_get_config_type(ipconfig);
+
+       __connman_notifier_ipconfig_changed(service, ipconfig);
+
        if (!allow_property_changed(service))
                return;
 
-       type = __connman_ipconfig_get_config_type(ipconfig);
-
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                connman_dbus_property_changed_dict(service->path,
                                        CONNMAN_SERVICE_INTERFACE, "IPv4",
@@ -2380,8 +2886,6 @@ static void settings_changed(struct connman_service *service,
                connman_dbus_property_changed_dict(service->path,
                                        CONNMAN_SERVICE_INTERFACE, "IPv6",
                                        append_ipv6, service);
-
-       __connman_notifier_ipconfig_changed(service, ipconfig);
 }
 
 static void ipv4_configuration_changed(struct connman_service *service)
@@ -2396,6 +2900,15 @@ static void ipv4_configuration_changed(struct connman_service *service)
                                                        service);
 }
 
+void __connman_service_notify_ipv4_configuration(
+                                       struct connman_service *service)
+{
+       if (!service)
+               return;
+
+       ipv4_configuration_changed(service);
+}
+
 static void ipv6_configuration_changed(struct connman_service *service)
 {
        if (!allow_property_changed(service))
@@ -2657,7 +3170,7 @@ void __connman_service_notify(struct connman_service *service,
        if (!service)
                return;
 
-       if (!is_connected(service))
+       if (!is_connected(service->state))
                return;
 
        stats_update(service,
@@ -2743,28 +3256,48 @@ static void append_wifi_ext_info(DBusMessageIter *dict,
 {
        char bssid_buff[WIFI_BSSID_STR_LEN] = {0,};
        char *bssid_str = bssid_buff;
+       const void *ssid;
+       unsigned int ssid_len;
        unsigned char *bssid;
        unsigned int maxrate;
+       int maxspeed;
        unsigned int keymgmt;
        uint16_t frequency;
        const char *enc_mode;
+       const char *str;
        gboolean passpoint;
+       char country_code_buff[WIFI_COUNTRY_CODE_LEN + 1] = {0,};
+       char *country_code_str = country_code_buff;
+       unsigned char *country_code;
+       uint16_t connection_mode;
 
+       ssid = connman_network_get_blob(network, "WiFi.SSID", &ssid_len);
        bssid = connman_network_get_bssid(network);
        maxrate = connman_network_get_maxrate(network);
+       maxspeed = connman_network_get_maxspeed(network);
        frequency = connman_network_get_frequency(network);
        enc_mode = connman_network_get_enc_mode(network);
-       passpoint = connman_network_get_is_hs20AP(network);
+       passpoint = connman_network_get_bool(network, "WiFi.HS20AP");
        keymgmt = connman_network_get_keymgmt(network);
+       country_code = connman_network_get_countrycode(network);
+       connection_mode = connman_network_get_connection_mode(network);
 
        snprintf(bssid_str, WIFI_BSSID_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
                                bssid[0], bssid[1], bssid[2],
                                bssid[3], bssid[4], bssid[5]);
 
+       snprintf(country_code_str, (WIFI_COUNTRY_CODE_LEN + 1), "%c%c",
+                country_code[0], country_code[1]);
+
+
+       connman_dbus_dict_append_fixed_array(dict, "SSID",
+                                       DBUS_TYPE_BYTE, &ssid, ssid_len);
        connman_dbus_dict_append_basic(dict, "BSSID",
                                        DBUS_TYPE_STRING, &bssid_str);
        connman_dbus_dict_append_basic(dict, "MaxRate",
                                        DBUS_TYPE_UINT32, &maxrate);
+       connman_dbus_dict_append_basic(dict, "MaxSpeed",
+                                       DBUS_TYPE_INT32, &maxspeed);
        connman_dbus_dict_append_basic(dict, "Frequency",
                                        DBUS_TYPE_UINT16, &frequency);
        connman_dbus_dict_append_basic(dict, "EncryptionMode",
@@ -2773,6 +3306,74 @@ static void append_wifi_ext_info(DBusMessageIter *dict,
                                        DBUS_TYPE_BOOLEAN, &passpoint);
        connman_dbus_dict_append_basic(dict, "Keymgmt",
                                        DBUS_TYPE_UINT32, &keymgmt);
+       connman_dbus_dict_append_basic(dict, "Country", DBUS_TYPE_STRING,
+                                      &country_code_str);
+       connman_dbus_dict_append_basic(dict, "ConnMode",
+                                       DBUS_TYPE_UINT16, &connection_mode);
+
+       str = connman_network_get_string(network, "WiFi.Security");
+       if (str != NULL && g_str_equal(str, "ieee8021x") == TRUE) {
+               str = connman_network_get_string(network, "WiFi.EAP");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "EAP",
+                                       DBUS_TYPE_STRING, &str);
+
+               str = connman_network_get_string(network, "WiFi.Phase2");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "Phase2",
+                                       DBUS_TYPE_STRING, &str);
+
+               str = connman_network_get_string(network, "WiFi.Identity");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "Identity",
+                                       DBUS_TYPE_STRING, &str);
+
+               str = connman_network_get_string(network, "WiFi.CACertFile");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "CACertFile",
+                                       DBUS_TYPE_STRING, &str);
+
+               str = connman_network_get_string(network,
+                               "WiFi.ClientCertFile");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "ClientCertFile",
+                                       DBUS_TYPE_STRING, &str);
+
+               str = connman_network_get_string(network,
+                               "WiFi.PrivateKeyFile");
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "PrivateKeyFile",
+                                       DBUS_TYPE_STRING, &str);
+       }
+}
+
+static void append_bssid_info(DBusMessageIter *iter, void *user_data)
+{
+       GSList *bssid_list = NULL;
+       struct connman_network *network = user_data;
+       struct connman_bssids *bssids;
+       char bssid_buf[MAC_ADDRESS_LENGTH] = {0,};
+       char *bssid_str = bssid_buf;
+
+       bssid_list = (GSList *)connman_network_get_bssid_list(network);
+       if(bssid_list) {
+               GSList *list;
+               for (list = bssid_list; list; list = list->next) {
+                       bssids = (struct connman_bssids *)list->data;
+                       g_snprintf(bssid_buf, MAC_ADDRESS_LENGTH, "%02x:%02x:%02x:%02x:%02x:%02x",
+                                       bssids->bssid[0], bssids->bssid[1], bssids->bssid[2],
+                                       bssids->bssid[3], bssids->bssid[4], bssids->bssid[5]);
+
+                       connman_dbus_dict_append_basic(iter, "BSSID",
+                                       DBUS_TYPE_STRING, &bssid_str);
+
+                       connman_dbus_dict_append_basic(iter, "Strength",
+                                       DBUS_TYPE_UINT16, &bssids->strength);
+
+                       connman_dbus_dict_append_basic(iter, "Frequency",
+                                       DBUS_TYPE_UINT16, &bssids->frequency);
+               }
+       }
 }
 #endif
 
@@ -2790,6 +3391,24 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "Frequency",
                                DBUS_TYPE_UINT16, &frequency);
        }
+
+       unsigned char *wifi_vsie;
+       unsigned int wifi_vsie_len;
+       GSList *vsie_list = NULL;
+
+       if (service->network)
+               vsie_list = (GSList *)connman_network_get_vsie_list(service->network);
+
+       if (vsie_list) {
+               GSList *list;
+               for (list = vsie_list; list; list = list->next) {
+                       wifi_vsie = (unsigned char *)list->data;
+                       wifi_vsie_len = wifi_vsie[1] + 2;
+
+                       connman_dbus_dict_append_fixed_array(dict, "Vsie", DBUS_TYPE_BYTE,
+                                       &wifi_vsie, wifi_vsie_len);
+               }
+       }
 #endif
 
        str = __connman_service_type2string(service->type);
@@ -2806,12 +3425,10 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                                                DBUS_TYPE_STRING, &str);
 
 #ifdef TIZEN_EXT
-       if (TIZEN_TV_EXT) {
-               str = state2string(service->state_ipv6);
-               if (str != NULL)
-                       connman_dbus_dict_append_basic(dict, "StateIPv6",
-                                                       DBUS_TYPE_STRING, &str);
-       }
+       str = state2string(service->state_ipv6);
+       if (str != NULL)
+               connman_dbus_dict_append_basic(dict, "StateIPv6",
+                               DBUS_TYPE_STRING, &str);
 #endif
 
        str = error2string(service->error);
@@ -2849,6 +3466,9 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_VPN:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                break;
        case CONNMAN_SERVICE_TYPE_CELLULAR:
                val = service->roaming;
@@ -2860,8 +3480,11 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                break;
        case CONNMAN_SERVICE_TYPE_WIFI:
 #if defined TIZEN_EXT
-               if (service->network != NULL)
+               if (service->network != NULL) {
                        append_wifi_ext_info(dict, service->network);
+                       connman_dbus_dict_append_dict(dict, "BSSID.List",
+                                       append_bssid_info, service->network);
+               }
 
                connman_dbus_dict_append_dict(dict, "Ethernet",
                                                append_ethernet, service);
@@ -2869,6 +3492,9 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "DisconnectReason",
                                DBUS_TYPE_INT32, &service->disconnect_reason);
 
+               connman_dbus_dict_append_basic(dict, "AssocStatusCode",
+                               DBUS_TYPE_INT32, &service->assoc_status_code);
+
                break;
 #endif
        case CONNMAN_SERVICE_TYPE_ETHERNET:
@@ -3238,6 +3864,18 @@ const char *connman_service_get_proxy_autoconfig(struct connman_service *service
        return NULL;
 }
 
+#if defined TIZEN_EXT
+int connman_service_get_ipv6_dns_method(struct connman_service *service)
+{
+       if (!service) {
+               DBG("Service is NULL");
+               return -1;
+       }
+
+       return service->dns_config_method_ipv6;
+}
+#endif
+
 void __connman_service_set_timeservers(struct connman_service *service,
                                char **timeservers)
 {
@@ -3396,6 +4034,81 @@ void __connman_service_set_identity(struct connman_service *service,
                                        service->identity);
 }
 
+void __connman_service_set_anonymous_identity(struct connman_service *service,
+                                               const char *anonymous_identity)
+{
+       if (service->immutable || service->hidden)
+               return;
+
+       g_free(service->anonymous_identity);
+       service->anonymous_identity = g_strdup(anonymous_identity);
+
+       if (service->network)
+               connman_network_set_string(service->network,
+                                       "WiFi.AnonymousIdentity",
+                                       service->anonymous_identity);
+}
+
+void __connman_service_set_subject_match(struct connman_service *service,
+                                               const char *subject_match)
+{
+       if (service->immutable || service->hidden)
+               return;
+
+       g_free(service->subject_match);
+       service->subject_match = g_strdup(subject_match);
+
+       if (service->network)
+               connman_network_set_string(service->network,
+                                       "WiFi.SubjectMatch",
+                                       service->subject_match);
+}
+
+void __connman_service_set_altsubject_match(struct connman_service *service,
+                                               const char *altsubject_match)
+{
+       if (service->immutable || service->hidden)
+               return;
+
+       g_free(service->altsubject_match);
+       service->altsubject_match = g_strdup(altsubject_match);
+
+       if (service->network)
+               connman_network_set_string(service->network,
+                                       "WiFi.AltSubjectMatch",
+                                       service->altsubject_match);
+}
+
+void __connman_service_set_domain_suffix_match(struct connman_service *service,
+                                               const char *domain_suffix_match)
+{
+       if (service->immutable || service->hidden)
+               return;
+
+       g_free(service->domain_suffix_match);
+       service->domain_suffix_match = g_strdup(domain_suffix_match);
+
+       if (service->network)
+               connman_network_set_string(service->network,
+                                       "WiFi.DomainSuffixMatch",
+                                       service->domain_suffix_match);
+}
+
+void __connman_service_set_domain_match(struct connman_service *service,
+                                               const char *domain_match)
+{
+       if (service->immutable || service->hidden)
+               return;
+
+       g_free(service->domain_match);
+       service->domain_match = g_strdup(domain_match);
+
+       if (service->network)
+               connman_network_set_string(service->network,
+                                       "WiFi.DomainMatch",
+                                       service->domain_match);
+}
+
 void __connman_service_set_agent_identity(struct connman_service *service,
                                                const char *agent_identity)
 {
@@ -3410,7 +4123,7 @@ void __connman_service_set_agent_identity(struct connman_service *service,
                                        service->agent_identity);
 }
 
-static int check_passphrase(enum connman_service_security security,
+int __connman_service_check_passphrase(enum connman_service_security security,
                const char *passphrase)
 {
        guint i;
@@ -3437,6 +4150,8 @@ static int check_passphrase(enum connman_service_security security,
        case CONNMAN_SERVICE_SECURITY_PSK:
 #if defined TIZEN_EXT
        case CONNMAN_SERVICE_SECURITY_RSN:
+       /* TO CHECK: We need to check the key length supported by SAE */
+       case CONNMAN_SERVICE_SECURITY_SAE:
 #endif
                /* A raw key is always 64 bytes length,
                 * its content is in hex representation.
@@ -3481,8 +4196,16 @@ int __connman_service_set_passphrase(struct connman_service *service,
        if (service->immutable &&
                        service->security != CONNMAN_SERVICE_SECURITY_8021X)
                return -EINVAL;
-
-       err = check_passphrase(service->security, passphrase);
+#if defined TIZEN_EXT
+       /* The encrypted passphrase is used here
+        * and validation is done by net-config before being encrypted.
+        */
+       err = 0;
+       if (service->security != CONNMAN_SERVICE_SECURITY_PSK &&
+                       service->security != CONNMAN_SERVICE_SECURITY_RSN &&
+                       service->security != CONNMAN_SERVICE_SECURITY_WEP)
+#endif
+       err = __connman_service_check_passphrase(service->security, passphrase);
 
        if (err < 0)
                return err;
@@ -3512,8 +4235,6 @@ static DBusMessage *get_properties(DBusConnection *conn,
        DBusMessage *reply;
        DBusMessageIter array, dict;
 
-       DBG("service %p", service);
-
        reply = dbus_message_new_method_return(msg);
        if (!reply)
                return NULL;
@@ -3527,6 +4248,23 @@ static DBusMessage *get_properties(DBusConnection *conn,
        return reply;
 }
 
+static char **remove_empty_strings(char **strv)
+{
+       int index = 0;
+       char **iter = strv;
+
+       while (*iter) {
+               if (**iter)
+                       strv[index++] = *iter;
+               else
+                       g_free(*iter);
+               iter++;
+       }
+
+       strv[index] = NULL;
+       return strv;
+}
+
 static int update_proxy_configuration(struct connman_service *service,
                                DBusMessageIter *array)
 {
@@ -3640,20 +4378,24 @@ static int update_proxy_configuration(struct connman_service *service,
                if (servers_str) {
                        g_strfreev(service->proxies);
 
-                       if (servers_str->len > 0)
-                               service->proxies = g_strsplit_set(
+                       if (servers_str->len > 0) {
+                               char **proxies = g_strsplit_set(
                                        servers_str->str, " ", 0);
-                       else
+                               proxies = remove_empty_strings(proxies);
+                               service->proxies = proxies;
+                       } else
                                service->proxies = NULL;
                }
 
                if (excludes_str) {
                        g_strfreev(service->excludes);
 
-                       if (excludes_str->len > 0)
-                               service->excludes = g_strsplit_set(
+                       if (excludes_str->len > 0) {
+                               char **excludes = g_strsplit_set(
                                        excludes_str->str, " ", 0);
-                       else
+                               excludes = remove_empty_strings(excludes);
+                               service->excludes = excludes;
+                       } else
                                service->excludes = NULL;
                }
 
@@ -3665,7 +4407,7 @@ static int update_proxy_configuration(struct connman_service *service,
                g_free(service->pac);
 
                if (url && strlen(url) > 0)
-                       service->pac = g_strdup(url);
+                       service->pac = g_strstrip(g_strdup(url));
                else
                        service->pac = NULL;
 
@@ -3742,8 +4484,7 @@ int __connman_service_reset_ipconfig(struct connman_service *service,
                new_method = __connman_ipconfig_get_method(new_ipconfig);
        }
 
-       if (is_connecting_state(service, state) ||
-                                       is_connected_state(service, state))
+       if (is_connecting(state) || is_connected(state))
                __connman_network_clear_ipconfig(service->network, ipconfig);
 
        __connman_ipconfig_unref(ipconfig);
@@ -3753,8 +4494,7 @@ int __connman_service_reset_ipconfig(struct connman_service *service,
        else if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
                service->ipconfig_ipv6 = new_ipconfig;
 
-       if (is_connecting_state(service, state) ||
-                                       is_connected_state(service, state))
+       if (is_connecting(state) || is_connected(state))
                __connman_ipconfig_enable(new_ipconfig);
 
        if (new_state && new_method != old_method) {
@@ -3763,6 +4503,9 @@ int __connman_service_reset_ipconfig(struct connman_service *service,
                else
                        *new_state = service->state_ipv6;
 
+               settings_changed(service, new_ipconfig);
+               address_updated(service, new_method);
+
                __connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO);
        }
 
@@ -3789,7 +4532,7 @@ static DBusMessage *set_property(DBusConnection *conn,
        if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
                return __connman_error_invalid_arguments(msg);
 
-       if (service->type == CONNMAN_SERVICE_TYPE_WIFI && is_connected(service)) {
+       if (service->type == CONNMAN_SERVICE_TYPE_WIFI && is_connected(service->state)) {
                uid_t uid;
                if (connman_dbus_get_connection_unix_user_sync(conn,
                                                dbus_message_get_sender(msg),
@@ -3841,6 +4584,10 @@ static DBusMessage *set_property(DBusConnection *conn,
                GString *str;
                int index;
                const char *gw;
+#if defined TIZEN_EXT
+               enum connman_ipconfig_type ip_type = CONNMAN_IPCONFIG_TYPE_ALL;
+               DBG("%s", name);
+#endif
 
                if (__connman_provider_is_immutable(service->provider) ||
                                service->immutable)
@@ -3857,44 +4604,101 @@ static DBusMessage *set_property(DBusConnection *conn,
                gw = __connman_ipconfig_get_gateway_from_index(index,
                        CONNMAN_IPCONFIG_TYPE_ALL);
 
+#if !defined TIZEN_EXT
                if (gw && strlen(gw))
                        __connman_service_nameserver_del_routes(service,
                                                CONNMAN_IPCONFIG_TYPE_ALL);
-
+#endif
                dbus_message_iter_recurse(&value, &entry);
 
+#if defined TIZEN_EXT
+               /* IPv4/IPv6 Last DNS config method */
+               int last_dns_ipv4 = service->dns_config_method_ipv4;
+               int last_dns_ipv6 = service->dns_config_method_ipv6;
+               DBG("Last DNS Config Method IPv4: %d IPv6: %d", last_dns_ipv4, last_dns_ipv6);
+#endif
+
                while (dbus_message_iter_get_arg_type(&entry) == DBUS_TYPE_STRING) {
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
 #ifdef TIZEN_EXT
-                       if (TIZEN_TV_EXT) {
-                               /* First unpack the DNS Config Method */
-                               if(g_strcmp0(val, "manual") == 0) {
-                                       service->dns_config_method =
-                                               CONNMAN_DNSCONFIG_METHOD_MANUAL;
-                                       continue;
-                               } else if(g_strcmp0(val, "dhcp") == 0) {
-                                       service->dns_config_method =
-                                               CONNMAN_DNSCONFIG_METHOD_DHCP;
-                                       continue;
+                       /* First unpack the DNS Config Method */
+                       DBG("DNS Config Method: %s", val);
+                       if((g_strcmp0(val, "ipv4.manual") == 0)) {
+                               service->dns_config_method_ipv4 =
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL;
+
+                               if(last_dns_ipv4 != CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       if(ip_type == CONNMAN_IPCONFIG_TYPE_UNKNOWN)
+                                               ip_type = CONNMAN_IPCONFIG_TYPE_IPV4;
+                                       else
+                                               ip_type = CONNMAN_IPCONFIG_TYPE_ALL;
+                               }
+                               continue;
+                       } else if(g_strcmp0(val, "ipv4.dhcp") == 0) {
+                               service->dns_config_method_ipv4 =
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP;
+                               if(last_dns_ipv4 == CONNMAN_DNSCONFIG_METHOD_MANUAL)
+                                       ip_type = CONNMAN_IPCONFIG_TYPE_IPV4;
+
+                               continue;
+                       } else if(g_strcmp0(val, "ipv6.manual") == 0) {
+                               service->dns_config_method_ipv6 =
+                                       CONNMAN_DNSCONFIG_METHOD_MANUAL;
+                               if(last_dns_ipv6 != CONNMAN_DNSCONFIG_METHOD_MANUAL) {
+                                       if(ip_type == CONNMAN_IPCONFIG_TYPE_UNKNOWN)
+                                               ip_type = CONNMAN_IPCONFIG_TYPE_IPV6;
+                                       else
+                                               ip_type = CONNMAN_IPCONFIG_TYPE_ALL;
                                }
+                               continue;
+                       } else if(g_strcmp0(val, "ipv6.dhcp") == 0) {
+                               service->dns_config_method_ipv6 =
+                                       CONNMAN_DNSCONFIG_METHOD_DHCP;
+                               if(last_dns_ipv6 == CONNMAN_DNSCONFIG_METHOD_MANUAL)
+                                       ip_type = CONNMAN_IPCONFIG_TYPE_IPV6;
+
+                               continue;
                        }
 #endif
-                       if (connman_inet_check_ipaddress(val) > 0) {
-                               if (str->len > 0)
-                                       g_string_append_printf(str, " %s", val);
-                               else
-                                       g_string_append(str, val);
-                       }
+                       if (!val[0])
+                               continue;
+
+                       if (str->len > 0)
+                               g_string_append_printf(str, " %s", val);
+                       else
+                               g_string_append(str, val);
+               }
+
+#if defined TIZEN_EXT
+               if (service->dns_config_method_ipv4 == CONNMAN_DNSCONFIG_METHOD_DHCP &&
+                       service->dns_config_method_ipv6 == CONNMAN_DNSCONFIG_METHOD_DHCP) {
+                                       DBG("Both IPv4 and IPv6 DNS Method DHCP");
+                                       ip_type = CONNMAN_IPCONFIG_TYPE_ALL;
                }
+               if (gw && strlen(gw))
+                       __connman_service_nameserver_del_routes(service,
+                                               ip_type);
 
-               nameserver_remove_all(service);
+               DBG("%s ip_type: %d nameserver remove all", name, ip_type);
+               nameserver_remove_all(service, ip_type);
+#else
+               nameserver_remove_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
+#endif
                g_strfreev(service->nameservers_config);
 
                if (str->len > 0) {
-                       service->nameservers_config =
-                               g_strsplit_set(str->str, " ", 0);
+                       char **nameservers, **iter;
+
+                       nameservers = g_strsplit_set(str->str, " ", 0);
+
+                       for (iter = nameservers; *iter; iter++)
+                               if (connman_inet_check_ipaddress(*iter) <= 0)
+                                       *iter[0] = '\0';
+
+                       nameservers = remove_empty_strings(nameservers);
+                       service->nameservers_config = nameservers;
                } else {
                        service->nameservers_config = NULL;
                }
@@ -3904,7 +4708,12 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (gw && strlen(gw))
                        __connman_service_nameserver_add_routes(service, gw);
 
-               nameserver_add_all(service);
+#if defined TIZEN_EXT
+               DBG("%s ip_type: %d nameserver add all", name, ip_type);
+               nameserver_add_all(service, ip_type);
+#else
+               nameserver_add_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
+#endif
                dns_configuration_changed(service);
 
                if (__connman_service_is_connected_state(service,
@@ -3920,8 +4729,7 @@ static DBusMessage *set_property(DBusConnection *conn,
                service_save(service);
        } else if (g_str_equal(name, "Timeservers.Configuration")) {
                DBusMessageIter entry;
-               GSList *list = NULL;
-               int count = 0;
+               GString *str;
 
                if (service->immutable)
                        return __connman_error_not_supported(msg);
@@ -3929,35 +4737,37 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (type != DBUS_TYPE_ARRAY)
                        return __connman_error_invalid_arguments(msg);
 
+               str = g_string_new(NULL);
+               if (!str)
+                       return __connman_error_invalid_arguments(msg);
+
                dbus_message_iter_recurse(&value, &entry);
 
                while (dbus_message_iter_get_arg_type(&entry) == DBUS_TYPE_STRING) {
                        const char *val;
-                       GSList *new_head;
-
                        dbus_message_iter_get_basic(&entry, &val);
+                       dbus_message_iter_next(&entry);
 
-                       new_head = __connman_timeserver_add_list(list, val);
-                       if (list != new_head) {
-                               count++;
-                               list = new_head;
-                       }
+                       if (!val[0])
+                               continue;
 
-                       dbus_message_iter_next(&entry);
+                       if (str->len > 0)
+                               g_string_append_printf(str, " %s", val);
+                       else
+                               g_string_append(str, val);
                }
 
                g_strfreev(service->timeservers_config);
                service->timeservers_config = NULL;
 
-               if (list) {
-                       service->timeservers_config = g_new0(char *, count+1);
+               if (str->len > 0) {
+                       char **timeservers = g_strsplit_set(str->str, " ", 0);
+                       timeservers = remove_empty_strings(timeservers);
+                       service->timeservers_config = timeservers;
+               } else
+                       service->timeservers = NULL;
 
-                       while (list) {
-                               count--;
-                               service->timeservers_config[count] = list->data;
-                               list = g_slist_delete_link(list, list);
-                       };
-               }
+               g_string_free(str, TRUE);
 
                service_save(service);
                timeservers_configuration_changed(service);
@@ -3985,6 +4795,10 @@ static DBusMessage *set_property(DBusConnection *conn,
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
+
+                       if (!val[0])
+                               continue;
+
                        if (str->len > 0)
                                g_string_append_printf(str, " %s", val);
                        else
@@ -3994,9 +4808,11 @@ static DBusMessage *set_property(DBusConnection *conn,
                searchdomain_remove_all(service);
                g_strfreev(service->domains);
 
-               if (str->len > 0)
-                       service->domains = g_strsplit_set(str->str, " ", 0);
-               else
+               if (str->len > 0) {
+                       char **domains = g_strsplit_set(str->str, " ", 0);
+                       domains = remove_empty_strings(domains);
+                       service->domains = domains;
+               } else
                        service->domains = NULL;
 
                g_string_free(str, TRUE);
@@ -4053,8 +4869,7 @@ static DBusMessage *set_property(DBusConnection *conn,
                                                                &state);
 
                if (err < 0) {
-                       if (is_connected_state(service, state) ||
-                                       is_connecting_state(service, state)) {
+                       if (is_connected(state) || is_connecting(state)) {
                                if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                                        __connman_network_enable_ipconfig(service->network,
                                                        service->ipconfig_ipv4);
@@ -4071,7 +4886,8 @@ static DBusMessage *set_property(DBusConnection *conn,
                else
                        ipv6_configuration_changed(service);
 
-               if (is_connecting(service) || is_connected(service)) {
+               if (is_connecting(service->state) ||
+                               is_connected(service->state)) {
                        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                                __connman_network_enable_ipconfig(service->network,
                                                                service->ipconfig_ipv4);
@@ -4081,6 +4897,19 @@ static DBusMessage *set_property(DBusConnection *conn,
                }
 
                service_save(service);
+#if defined TIZEN_EXT
+               /* When AP is connected using WPS without SSID then its password needs
+                * to be saved for autoconnection */
+       } else if (g_str_equal(name, "Passphrase")) {
+               char *passphrase;
+
+               if (type != DBUS_TYPE_STRING)
+                       return __connman_error_invalid_arguments(msg);
+
+               dbus_message_iter_get_basic(&value, &passphrase);
+
+               __connman_service_set_passphrase(service, passphrase);
+#endif
        } else
                return __connman_error_invalid_property(msg);
 
@@ -4115,6 +4944,41 @@ static void set_error(struct connman_service *service,
                                DBUS_TYPE_STRING, &str);
 }
 
+static void remove_timeout(struct connman_service *service)
+{
+       if (service->timeout > 0) {
+               g_source_remove(service->timeout);
+               service->timeout = 0;
+       }
+}
+
+static void reply_pending(struct connman_service *service, int error)
+{
+       remove_timeout(service);
+
+       if (service->pending) {
+               connman_dbus_reply_pending(service->pending, error, NULL);
+               service->pending = NULL;
+       }
+
+       if (service->provider_pending) {
+               connman_dbus_reply_pending(service->provider_pending,
+                               error, service->path);
+               service->provider_pending = NULL;
+       }
+}
+
+static void service_complete(struct connman_service *service)
+{
+       reply_pending(service, EIO);
+
+       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
+               __connman_service_auto_connect(service->connect_reason);
+
+       g_get_current_time(&service->modified);
+       service_save(service);
+}
+
 static void set_idle(struct connman_service *service)
 {
        service->state = service->state_ipv4 = service->state_ipv6 =
@@ -4137,8 +5001,8 @@ static DBusMessage *clear_property(DBusConnection *conn,
        if (g_str_equal(name, "Error")) {
                set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
 
-               g_get_current_time(&service->modified);
-               service_save(service);
+               __connman_service_clear_error(service);
+               service_complete(service);
        } else
                return __connman_error_invalid_property(msg);
 
@@ -4193,6 +5057,7 @@ static void disconnect_on_last_session(enum connman_service_type type)
 }
 
 static int active_sessions[MAX_CONNMAN_SERVICE_TYPES] = {};
+static int always_connect[MAX_CONNMAN_SERVICE_TYPES] = {};
 static int active_count = 0;
 
 void __connman_service_set_active_session(bool enable, GSList *list)
@@ -4205,7 +5070,7 @@ void __connman_service_set_active_session(bool enable, GSList *list)
        else
                active_count--;
 
-       while (list != NULL) {
+       while (list) {
                enum connman_service_type type = GPOINTER_TO_INT(list->data);
 
                switch (type) {
@@ -4225,6 +5090,9 @@ void __connman_service_set_active_session(bool enable, GSList *list)
                case CONNMAN_SERVICE_TYPE_GPS:
                case CONNMAN_SERVICE_TYPE_VPN:
                case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+               case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                        break;
                }
 
@@ -4277,7 +5145,7 @@ static GList *preferred_tech_list_get(void)
                for (list = service_list; list; list = list->next) {
                        struct connman_service *service = list->data;
 
-                       if (!is_connected(service))
+                       if (!is_connected(service->state))
                                break;
 
                        if (service->connect_reason ==
@@ -4309,6 +5177,43 @@ static GList *preferred_tech_list_get(void)
        return tech_data.preferred_list;
 }
 
+static void set_always_connecting_technologies()
+{
+       unsigned int *always_connected_techs =
+               connman_setting_get_uint_list("AlwaysConnectedTechnologies");
+       int i;
+       for (i = 0; always_connected_techs && always_connected_techs[i]; i++)
+               always_connect[always_connected_techs[i]] = 1;
+}
+
+static bool autoconnect_no_session_active(struct connman_service *service)
+{
+       /*
+        * Test active_count to see if there are no sessions set up and
+        * stop autoconnecting, but continue connecting if the service
+        * belongs to a technology which should always autoconnect.
+        */
+       if (!active_count && !always_connect[service->type])
+               return true;
+
+       return false;
+}
+
+static bool autoconnect_already_connecting(struct connman_service *service,
+                                          bool autoconnecting)
+{
+       /*
+        * If another service is already connecting and this service type has
+        * not been marked as always connecting, stop the connecting procedure.
+        */
+       if (autoconnecting &&
+                       !active_sessions[service->type] &&
+                       !always_connect[service->type])
+               return true;
+
+       return false;
+}
+
 static bool auto_connect_service(GList *services,
                                enum connman_service_connect_reason reason,
                                bool preferred)
@@ -4323,6 +5228,12 @@ static bool auto_connect_service(GList *services,
 
        ignore[CONNMAN_SERVICE_TYPE_VPN] = true;
 
+#if defined TIZEN_EXT_WIFI_MESH
+       /* Don't auto connect wifi if mesh interface is created */
+       if (connman_mesh_is_interface_created())
+               ignore[CONNMAN_SERVICE_TYPE_WIFI] = true;
+#endif
+
        for (list = services; list; list = list->next) {
                service = list->data;
 
@@ -4342,15 +5253,15 @@ static bool auto_connect_service(GList *services,
 
                /* Tizen takes Wi-Fi as the highest priority into consideration. */
                if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
-                       if (is_connecting(service) == TRUE || is_connected(service) == TRUE)
+                       if (is_connecting(service->state) == TRUE || is_connected(service->state) == TRUE)
                                continue;
 #endif
 
                if (service->pending ||
-                               is_connecting(service) ||
-                               is_connected(service)) {
-                       if (!active_count)
-                               return true;
+                               is_connecting(service->state) ||
+                               is_connected(service->state)) {
+                       if (autoconnect_no_session_active(service))
+                                       return true;
 
                        ignore[service->type] = true;
                        autoconnecting = true;
@@ -4365,14 +5276,26 @@ static bool auto_connect_service(GList *services,
                        if (preferred)
                               continue;
 
+#if defined TIZEN_EXT
+                       DBG("Service is not favorite, autoconnecting %d",
+                                       autoconnecting);
+#endif
                        return autoconnecting;
                }
 
+#if defined TIZEN_EXT
+               DBG("service %p identifier %s roaming %d ignore %d "
+                               "ipconfig_usable %d autoconnect %d state %d",
+                               service,
+                               service->identifier, service->roaming,
+                               service->ignore, is_ipconfig_usable(service),
+                               service->autoconnect, service->state);
+#endif
                if (is_ignore(service) || service->state !=
                                CONNMAN_SERVICE_STATE_IDLE)
                        continue;
 
-               if (autoconnecting && !active_sessions[service->type]) {
+               if (autoconnect_already_connecting(service, autoconnecting)) {
                        DBG("service %p type %s has no users", service,
                                __connman_service_type2string(service->type));
                        continue;
@@ -4388,7 +5311,7 @@ static bool auto_connect_service(GList *services,
 
                __connman_service_connect(service, reason);
 
-               if (!active_count)
+               if (autoconnect_no_session_active(service))
                        return true;
 
                ignore[service->type] = true;
@@ -4417,8 +5340,23 @@ static gboolean run_auto_connect(gpointer data)
        if (!autoconnecting || active_count)
                auto_connect_service(service_list, reason, false);
 
-       return FALSE;
+       return FALSE;
+}
+
+#if defined TIZEN_EXT
+bool __connman_service_get_auto_connect_mode(void)
+{
+       return auto_connect_mode;
+}
+
+void __connman_service_set_auto_connect_mode(bool enable)
+{
+       DBG("set auto_connect_mode = %d", enable);
+
+       if (auto_connect_mode != enable)
+               auto_connect_mode = enable;
 }
+#endif
 
 void __connman_service_auto_connect(enum connman_service_connect_reason reason)
 {
@@ -4427,6 +5365,13 @@ void __connman_service_auto_connect(enum connman_service_connect_reason reason)
        if (autoconnect_timeout != 0)
                return;
 
+#if defined TIZEN_EXT
+       if (auto_connect_mode == FALSE) {
+               DBG("Currently, not auto connection mode");
+               return;
+       }
+#endif
+
        if (!__connman_session_policy_autoconnect(reason))
                return;
 
@@ -4445,7 +5390,7 @@ void __connman_service_auto_connect(enum connman_service_connect_reason reason)
         * is ignored as its last state was FAILURE rather than IDLE */
        autoconnect_timeout = g_timeout_add(500, run_auto_connect,
 #else
-       autoconnect_timeout = g_timeout_add_seconds(0, run_auto_connect,
+       autoconnect_timeout = g_idle_add(run_auto_connect,
 #endif
                                                GUINT_TO_POINTER(reason));
 }
@@ -4463,7 +5408,8 @@ static gboolean run_vpn_auto_connect(gpointer data) {
                if (service->type != CONNMAN_SERVICE_TYPE_VPN)
                        continue;
 
-               if (is_connected(service) || is_connecting(service)) {
+               if (is_connected(service->state) ||
+                               is_connecting(service->state)) {
                        if (!service->do_split_routing)
                                need_split = true;
                        continue;
@@ -4499,31 +5445,7 @@ static void vpn_auto_connect(void)
                return;
 
        vpn_autoconnect_timeout =
-               g_timeout_add_seconds(0, run_vpn_auto_connect, NULL);
-}
-
-static void remove_timeout(struct connman_service *service)
-{
-       if (service->timeout > 0) {
-               g_source_remove(service->timeout);
-               service->timeout = 0;
-       }
-}
-
-static void reply_pending(struct connman_service *service, int error)
-{
-       remove_timeout(service);
-
-       if (service->pending) {
-               connman_dbus_reply_pending(service->pending, error, NULL);
-               service->pending = NULL;
-       }
-
-       if (service->provider_pending) {
-               connman_dbus_reply_pending(service->provider_pending,
-                                               error, service->path);
-               service->provider_pending = NULL;
-       }
+               g_idle_add(run_vpn_auto_connect, NULL);
 }
 
 bool
@@ -4600,9 +5522,6 @@ static gboolean connect_timeout(gpointer user_data)
        else if (service->provider)
                connman_provider_disconnect(service->provider);
 
-       __connman_ipconfig_disable(service->ipconfig_ipv4);
-       __connman_ipconfig_disable(service->ipconfig_ipv6);
-
        __connman_stats_service_unregister(service);
 
        if (service->pending) {
@@ -4651,6 +5570,12 @@ static DBusMessage *connect_service(DBusConnection *conn,
         */
        if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
                connman_service_user_pdn_connection_ref(service);
+
+       /*Reset the Disconnect Reason while issue connect request*/
+       service->disconnect_reason = 0;
+
+       /*Reset the association status code while issue connect request*/
+       service->assoc_status_code = 0;
 #endif
 
        if (service->pending)
@@ -4691,7 +5616,7 @@ static DBusMessage *connect_service(DBusConnection *conn,
                if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
                        break;
 #endif
-               if (!is_connecting(temp) && !is_connected(temp))
+               if (!is_connecting(temp->state) && !is_connected(temp->state))
                        break;
 
                if (service == temp)
@@ -4746,7 +5671,7 @@ static DBusMessage *disconnect_service(DBusConnection *conn,
                if (connman_service_user_pdn_connection_unref_and_test(service) != TRUE)
                        return __connman_error_failed(msg, EISCONN);
 
-               if (is_connected(service) == TRUE &&
+               if (is_connected(service->state) == TRUE &&
                                service == connman_service_get_default_connection())
                        return __connman_error_failed(msg, EISCONN);
        }
@@ -4791,6 +5716,7 @@ static void __connman_service_cleanup_network_8021x(struct connman_service *serv
        connman_network_set_string(service->network, "WiFi.PrivateKeyFile", NULL);
        connman_network_set_string(service->network, "WiFi.PrivateKeyPassphrase", NULL);
        connman_network_set_string(service->network, "WiFi.Phase2", NULL);
+       connman_network_set_string(service->network, "WiFi.AnonymousIdentity", NULL);
 }
 #endif
 
@@ -4805,8 +5731,7 @@ bool __connman_service_remove(struct connman_service *service)
                return false;
 
 #if !defined TIZEN_EXT
-       if (!service->favorite && service->state !=
-                                               CONNMAN_SERVICE_STATE_FAILURE)
+       if (!service->favorite && !is_idle(service->state))
                return false;
 #endif
 
@@ -4818,6 +5743,21 @@ bool __connman_service_remove(struct connman_service *service)
        g_free(service->identity);
        service->identity = NULL;
 
+       g_free(service->anonymous_identity);
+       service->anonymous_identity = NULL;
+
+       g_free(service->subject_match);
+       service->subject_match = NULL;
+
+       g_free(service->altsubject_match);
+       service->altsubject_match = NULL;
+
+       g_free(service->domain_suffix_match);
+       service->domain_suffix_match = NULL;
+
+       g_free(service->domain_match);
+       service->domain_match = NULL;
+
        g_free(service->agent_identity);
        service->agent_identity = NULL;
 
@@ -4867,6 +5807,15 @@ bool __connman_service_remove(struct connman_service *service)
        __connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);
 
 #if defined TIZEN_EXT
+       /* Reset IP Method and DNS Method to DHCP */
+       __connman_ipconfig_set_method(service->ipconfig_ipv4,
+                       CONNMAN_IPCONFIG_METHOD_DHCP);
+       service->dns_config_method_ipv4 = CONNMAN_DNSCONFIG_METHOD_DHCP;
+       g_strfreev(service->nameservers_config);
+       service->nameservers_config = NULL;
+#endif
+
+#if defined TIZEN_EXT
        __connman_storage_remove_service(service->identifier);
 #else
        service_save(service);
@@ -5011,11 +5960,11 @@ static DBusMessage *move_service(DBusConnection *conn,
                        return __connman_error_invalid_service(msg);
                }
 
-               target->do_split_routing = true;
+               set_split_routing(target, true);
        } else
-               target->do_split_routing = false;
+               set_split_routing(target, false);
 
-       service->do_split_routing = false;
+       set_split_routing(service, false);
 
        target4 = __connman_ipconfig_get_method(target->ipconfig_ipv4);
        target6 = __connman_ipconfig_get_method(target->ipconfig_ipv6);
@@ -5132,6 +6081,19 @@ static DBusMessage *get_user_favorite(DBusConnection *conn,
        return reply;
 }
 
+#if defined TIZEN_MAINTAIN_ONLINE
+static DBusMessage *downgrade_service(DBusConnection *conn,
+                                       DBusMessage *msg, void *user_data)
+{
+       struct connman_service *service = user_data;
+
+       downgrade_state(service);
+       __connman_connection_update_gateway();
+
+       return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+#endif
+
 static struct _services_notify {
        int id;
        GHashTable *add;
@@ -5144,17 +6106,23 @@ static void service_append_added_foreach(gpointer data, gpointer user_data)
        DBusMessageIter *iter = user_data;
 
        if (!service || !service->path) {
+#if !defined TIZEN_EXT
                DBG("service %p or path is NULL", service);
+#endif
                return;
        }
 
        if (g_hash_table_lookup(services_notify->add, service->path)) {
+#if !defined TIZEN_EXT
                DBG("new %s", service->path);
+#endif
 
                append_struct(service, iter);
                g_hash_table_remove(services_notify->add, service->path);
        } else {
+#if !defined TIZEN_EXT
                DBG("changed %s", service->path);
+#endif
 
                append_struct_service(iter, NULL, service);
        }
@@ -5247,10 +6215,8 @@ static bool allow_property_changed(struct connman_service *service)
                return FALSE;
 #endif
        if (g_hash_table_lookup_extended(services_notify->add, service->path,
-                                       NULL, NULL)) {
-               DBG("no property updates for service %p", service);
+                                       NULL, NULL))
                return false;
-       }
 
        return true;
 }
@@ -5280,6 +6246,9 @@ static const GDBusMethodTable service_methods[] = {
        { GDBUS_METHOD("GetUserFavorite",
                        NULL, GDBUS_ARGS({ "value", "v" }),
                        get_user_favorite) },
+#if defined TIZEN_MAINTAIN_ONLINE
+       { GDBUS_METHOD("Downgrade", NULL, NULL, downgrade_service) },
+#endif
        { },
 };
 
@@ -5298,6 +6267,11 @@ static void service_free(gpointer user_data)
 
        reply_pending(service, ENOENT);
 
+       if (service->nameservers_timeout) {
+               g_source_remove(service->nameservers_timeout);
+               dns_changed(service);
+       }
+
        __connman_notifier_service_remove(service);
        service_schedule_removed(service);
 
@@ -5356,8 +6330,13 @@ static void service_free(gpointer user_data)
        g_free(service->identifier);
        g_free(service->eap);
        g_free(service->identity);
+       g_free(service->anonymous_identity);
        g_free(service->agent_identity);
        g_free(service->ca_cert_file);
+       g_free(service->subject_match);
+       g_free(service->altsubject_match);
+       g_free(service->domain_suffix_match);
+       g_free(service->domain_match);
        g_free(service->client_cert_file);
        g_free(service->private_key_file);
        g_free(service->private_key_passphrase);
@@ -5530,8 +6509,8 @@ static gint service_compare(gconstpointer a, gconstpointer b)
 
        state_a = service_a->state;
        state_b = service_b->state;
-       a_connected = is_connected(service_a);
-       b_connected = is_connected(service_b);
+       a_connected = is_connected(state_a);
+       b_connected = is_connected(state_b);
 
        if (a_connected && b_connected) {
                if (service_a->order > service_b->order)
@@ -5556,9 +6535,9 @@ static gint service_compare(gconstpointer a, gconstpointer b)
                if (b_connected)
                        return 1;
 
-               if (is_connecting(service_a))
+               if (is_connecting(state_a))
                        return -1;
-               if (is_connecting(service_b))
+               if (is_connecting(state_b))
                        return 1;
        }
 
@@ -5569,6 +6548,20 @@ static gint service_compare(gconstpointer a, gconstpointer b)
                return 1;
 
        if (service_a->type != service_b->type) {
+               unsigned int *tech_array;
+               int i;
+
+               tech_array = connman_setting_get_uint_list(
+                                               "PreferredTechnologies");
+               if (tech_array) {
+                       for (i = 0; tech_array[i]; i++) {
+                               if (tech_array[i] == service_a->type)
+                                       return -1;
+
+                               if (tech_array[i] == service_b->type)
+                                       return 1;
+                       }
+               }
 
                if (service_a->type == CONNMAN_SERVICE_TYPE_ETHERNET)
                        return -1;
@@ -5616,6 +6609,12 @@ static void service_list_sort(void)
        }
 }
 
+int __connman_service_compare(const struct connman_service *a,
+                                       const struct connman_service *b)
+{
+       return service_compare(a, b);
+}
+
 /**
  * connman_service_get_type:
  * @service: service structure
@@ -5667,7 +6666,7 @@ bool __connman_service_is_user_allowed(enum connman_service_type type,
                if (service->type != type)
                        continue;
 
-               if (is_connected(service)) {
+               if (is_connected(service->state)) {
                        owner_user = service->user.favorite_user;
                        break;
                }
@@ -5737,14 +6736,12 @@ bool __connman_service_is_connected_state(struct connman_service *service,
        case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
                break;
        case CONNMAN_IPCONFIG_TYPE_IPV4:
-               return is_connected_state(service, service->state_ipv4);
+               return is_connected(service->state_ipv4);
        case CONNMAN_IPCONFIG_TYPE_IPV6:
-               return is_connected_state(service, service->state_ipv6);
+               return is_connected(service->state_ipv6);
        case CONNMAN_IPCONFIG_TYPE_ALL:
-               return is_connected_state(service,
-                                       CONNMAN_IPCONFIG_TYPE_IPV4) &&
-                       is_connected_state(service,
-                                       CONNMAN_IPCONFIG_TYPE_IPV6);
+               return is_connected(service->state_ipv4) &&
+                       is_connected(service->state_ipv6);
        }
 
        return false;
@@ -5807,7 +6804,7 @@ int __connman_service_get_connected_count_of_iface(
 
                index2 = __connman_service_get_index(service2);
 
-               if (is_connected(service2) && index2 > 0 && index1 == index2)
+               if (is_connected(service2->state) && index2 > 0 && index1 == index2)
                        count++;
 
                index2 = 0;
@@ -5927,9 +6924,24 @@ void __connman_service_set_string(struct connman_service *service,
        } else if (g_str_equal(key, "Identity")) {
                g_free(service->identity);
                service->identity = g_strdup(value);
+       } else if (g_str_equal(key, "AnonymousIdentity")) {
+               g_free(service->anonymous_identity);
+               service->anonymous_identity = g_strdup(value);
        } else if (g_str_equal(key, "CACertFile")) {
                g_free(service->ca_cert_file);
                service->ca_cert_file = g_strdup(value);
+       } else if (g_str_equal(key, "SubjectMatch")) {
+               g_free(service->subject_match);
+               service->subject_match = g_strdup(value);
+       } else if (g_str_equal(key, "AltSubjectMatch")) {
+               g_free(service->altsubject_match);
+               service->altsubject_match = g_strdup(value);
+       } else if (g_str_equal(key, "DomainSuffixMatch")) {
+               g_free(service->domain_suffix_match);
+               service->domain_suffix_match = g_strdup(value);
+       } else if (g_str_equal(key, "DomainMatch")) {
+               g_free(service->domain_match);
+               service->domain_match = g_strdup(value);
        } else if (g_str_equal(key, "ClientCertFile")) {
                g_free(service->client_cert_file);
                service->client_cert_file = g_strdup(value);
@@ -5959,17 +6971,6 @@ void __connman_service_set_search_domains(struct connman_service *service,
        searchdomain_add_all(service);
 }
 
-static void service_complete(struct connman_service *service)
-{
-       reply_pending(service, EIO);
-
-       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
-               __connman_service_auto_connect(service->connect_reason);
-
-       g_get_current_time(&service->modified);
-       service_save(service);
-}
-
 static void report_error_cb(void *user_context, bool retry,
                                                        void *user_data)
 {
@@ -6049,7 +7050,8 @@ static void request_input_cb(struct connman_service *service,
 
                        if (service->hidden)
                                __connman_service_return_error(service,
-                                                       ECANCELED, user_data);
+                                                       ECONNABORTED,
+                                                       user_data);
                        goto done;
                } else {
                        if (service->hidden)
@@ -6130,7 +7132,7 @@ static void downgrade_connected_services(void)
        for (list = service_list; list; list = list->next) {
                up_service = list->data;
 
-               if (!is_connected(up_service))
+               if (!is_connected(up_service->state))
                        continue;
 
                if (up_service->state == CONNMAN_SERVICE_STATE_ONLINE)
@@ -6173,7 +7175,7 @@ static int service_update_preferred_order(struct connman_service *default_servic
 #if defined TIZEN_EXT
 static gboolean __connman_service_can_drop(struct connman_service *service)
 {
-       if (is_connected(service) == TRUE || is_connecting(service) == TRUE) {
+       if (is_connected(service->state) == TRUE || is_connecting(service->state) == TRUE) {
                if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR)
                        return TRUE;
                else if (connman_service_is_no_ref_user_pdn_connection(service) == TRUE)
@@ -6204,7 +7206,12 @@ static void __connman_service_disconnect_default(struct connman_service *service
                default_connecting_device = NULL;
 }
 
+#if defined TIZEN_MAINTAIN_ONLINE
+static void __connman_service_connect_default(struct connman_service *current,
+                                                                 enum connman_service_state old_state)
+#else
 static void __connman_service_connect_default(struct connman_service *current)
+#endif
 {
        int err;
        GList *list;
@@ -6241,7 +7248,12 @@ static void __connman_service_connect_default(struct connman_service *current)
                }
 
                return;
-       } else if (is_connected(current) == TRUE || is_connecting(current) == TRUE)
+#if defined TIZEN_MAINTAIN_ONLINE
+       } else if (current->state == CONNMAN_SERVICE_STATE_READY &&
+                          old_state == CONNMAN_SERVICE_STATE_ONLINE) {
+               DBG("Device is downgraded: online --> ready");
+#endif
+       } else if (is_connected(current->state) == TRUE || is_connecting(current->state) == TRUE)
                return;
 
        /* Always-on: keep default cellular connection as possible */
@@ -6263,8 +7275,8 @@ static void __connman_service_connect_default(struct connman_service *current)
 
                if (default_internet) {
                        default_service = service;
-                       if (is_connected(default_service) == TRUE ||
-                                       is_connecting(default_service) == TRUE)
+                       if (is_connected(default_service->state) == TRUE ||
+                                       is_connecting(default_service->state) == TRUE)
                                return;
 
                        default_device = connman_network_get_device(default_service->network);
@@ -6310,7 +7322,7 @@ static void single_connected_tech(struct connman_service *allowed)
                if (service != allowed && service->type != allowed->type &&
                                __connman_service_can_drop(service) == TRUE)
 #else
-               if (!is_connected(service))
+               if (!is_connected(service->state))
                        break;
 
                if (service == allowed)
@@ -6341,10 +7353,22 @@ static void set_priority_connected_service(void)
        for (list = service_list; list; list = list->next) {
                service = list->data;
 
-               if (is_connected(service) == FALSE)
+               if (is_connected(service->state) == FALSE)
                        service->order = 5;
                else
+#if defined TIZEN_MAINTAIN_ONLINE
+               {
+                       if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
+                               service->state == CONNMAN_SERVICE_STATE_ONLINE)
+                               service->order = 6;
+                       else if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
+                               service->order = 6;
+                       else
+                               service->order = 5;
+               }
+#else
                        service->order = 6;
+#endif
        }
 }
 #endif
@@ -6392,13 +7416,15 @@ static int service_indicate_state(struct connman_service *service)
        if (old_state == CONNMAN_SERVICE_STATE_ONLINE)
                __connman_notifier_leave_online(service->type);
 
-       if (is_connected_state(service, old_state) &&
-                       !is_connected_state(service, new_state))
+       if (is_connected(old_state) && !is_connected(new_state))
                searchdomain_remove_all(service);
 
        service->state = new_state;
        state_changed(service);
 
+       if (!is_connected(old_state) && is_connected(new_state))
+               searchdomain_add_all(service);
+
        switch(new_state) {
        case CONNMAN_SERVICE_STATE_UNKNOWN:
 
@@ -6457,17 +7483,6 @@ static int service_indicate_state(struct connman_service *service)
 
                reply_pending(service, 0);
 
-               g_get_current_time(&service->modified);
-               service_save(service);
-
-               searchdomain_add_all(service);
-               dns_changed(service);
-               domain_changed(service);
-               proxy_changed(service);
-
-               if (old_state != CONNMAN_SERVICE_STATE_ONLINE)
-                       __connman_notifier_connect(service->type);
-
                if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
                        connman_network_get_bool(service->network,
                                                "WiFi.UseWPS")) {
@@ -6482,15 +7497,29 @@ static int service_indicate_state(struct connman_service *service)
                                                        "WiFi.UseWPS", false);
                }
 
+               g_get_current_time(&service->modified);
+               service_save(service);
+
+               domain_changed(service);
+               proxy_changed(service);
+
+               if (old_state != CONNMAN_SERVICE_STATE_ONLINE)
+                       __connman_notifier_connect(service->type);
+
                method = __connman_ipconfig_get_method(service->ipconfig_ipv6);
                if (method == CONNMAN_IPCONFIG_METHOD_OFF)
                        __connman_ipconfig_disable_ipv6(
                                                service->ipconfig_ipv6);
 
+#if !defined TIZEN_MAINTAIN_ONLINE
                if (connman_setting_get_bool("SingleConnectedTechnology"))
                        single_connected_tech(service);
                else if (service->type != CONNMAN_SERVICE_TYPE_VPN)
                        vpn_auto_connect();
+#else
+               if (service->type != CONNMAN_SERVICE_TYPE_VPN)
+                       vpn_auto_connect();
+#endif
 
 #if defined TIZEN_EXT
                if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
@@ -6500,6 +7529,15 @@ static int service_indicate_state(struct connman_service *service)
                break;
 
        case CONNMAN_SERVICE_STATE_ONLINE:
+#if defined TIZEN_MAINTAIN_ONLINE
+#if defined TIZEN_EXT
+               if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
+                       set_priority_connected_service();
+#endif
+
+               if (connman_setting_get_bool("SingleConnectedTechnology"))
+                       single_connected_tech(service);
+#endif
 
                break;
 
@@ -6510,6 +7548,7 @@ static int service_indicate_state(struct connman_service *service)
 
                def_service = __connman_service_get_default();
                service->disconnect_reason = connman_network_get_disconnect_reason(service->network);
+               service->assoc_status_code = connman_network_get_assoc_status_code(service->network);
 
                if (!__connman_notifier_is_connected() &&
                        def_service &&
@@ -6531,7 +7570,6 @@ static int service_indicate_state(struct connman_service *service)
                        __connman_service_get_connected_count_of_iface(
                                                        service) <= 0) {
 #endif
-               dns_changed(service);
                domain_changed(service);
                proxy_changed(service);
 #if defined TIZEN_EXT
@@ -6569,8 +7607,12 @@ static int service_indicate_state(struct connman_service *service)
        service_list_sort();
 
 #if defined TIZEN_EXT
+#if defined TIZEN_MAINTAIN_ONLINE
+       __connman_service_connect_default(service, old_state);
+#else
        __connman_service_connect_default(service);
 #endif
+#endif
 
        __connman_connection_update_gateway();
 
@@ -6677,7 +7719,7 @@ int __connman_service_indicate_default(struct connman_service *service)
 {
        DBG("service %p state %s", service, state2string(service->state));
 
-       if (!is_connected(service)) {
+       if (!is_connected(service->state)) {
                /*
                 * If service is not yet fully connected, then we must not
                 * change the default yet. The default gw will be changed
@@ -6813,12 +7855,35 @@ static gboolean redo_wispr(gpointer user_data)
        return FALSE;
 }
 
+#if defined TIZEN_MAINTAIN_ONLINE
+static gboolean redo_wispr_ipv4(gpointer user_data)
+{
+       struct connman_service *service = user_data;
+
+       DBG("");
+
+       __connman_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4);
+
+       return FALSE;
+}
+#endif
+
 int __connman_service_online_check_failed(struct connman_service *service,
                                        enum connman_ipconfig_type type)
 {
        DBG("service %p type %d count %d", service, type,
                                                service->online_check_count);
 
+#if defined TIZEN_MAINTAIN_ONLINE
+       /* Retry IPv4 stuff also */
+       if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+               connman_warn("Online check failed for %p %s", service,
+                                       service->name);
+
+               g_timeout_add_seconds(1, redo_wispr_ipv4, service);
+               return 0;
+       }
+#else
        /* currently we only retry IPv6 stuff */
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4 ||
                        service->online_check_count != 1) {
@@ -6826,6 +7891,7 @@ int __connman_service_online_check_failed(struct connman_service *service,
                        service->name);
                return 0;
        }
+#endif
 
        service->online_check_count = 0;
 
@@ -6871,6 +7937,26 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
        if (!ipconfig)
                return -EINVAL;
 
+       method = __connman_ipconfig_get_method(ipconfig);
+
+       switch (method) {
+       case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
+       case CONNMAN_IPCONFIG_METHOD_OFF:
+               if (new_state != CONNMAN_SERVICE_STATE_IDLE)
+                       connman_warn("ipconfig state %d ipconfig method %d",
+                               new_state, method);
+
+               new_state = CONNMAN_SERVICE_STATE_IDLE;
+               break;
+
+       case CONNMAN_IPCONFIG_METHOD_FIXED:
+       case CONNMAN_IPCONFIG_METHOD_MANUAL:
+       case CONNMAN_IPCONFIG_METHOD_DHCP:
+       case CONNMAN_IPCONFIG_METHOD_AUTO:
+               break;
+
+       }
+
        /* Any change? */
        if (old_state == new_state)
                return -EALREADY;
@@ -6895,11 +7981,9 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
 
        switch (new_state) {
        case CONNMAN_SERVICE_STATE_UNKNOWN:
-       case CONNMAN_SERVICE_STATE_IDLE:
        case CONNMAN_SERVICE_STATE_ASSOCIATION:
                break;
        case CONNMAN_SERVICE_STATE_CONFIGURATION:
-               __connman_ipconfig_enable(ipconfig);
                break;
        case CONNMAN_SERVICE_STATE_READY:
 #if defined TIZEN_EXT
@@ -6911,15 +7995,24 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
                        break;
                }
 #endif
-               if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+               if (connman_setting_get_bool("EnableOnlineCheck")) {
+                       if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
 #if !defined TIZEN_EXT
+                               check_proxy_setup(service);
+#endif
+#if defined TIZEN_MAINTAIN_ONLINE
+/*             if (old_state == CONNMAN_SERVICE_STATE_ONLINE) */
                        check_proxy_setup(service);
 #endif
+                       } else {
+                               service->online_check_count = 1;
+                               __connman_wispr_start(service, type);
+                       }
+               } else
+                       connman_info("Online check disabled. "
+                               "Default service remains in READY state.");
+               if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                        service_rp_filter(service, true);
-               } else {
-                       service->online_check_count = 1;
-                       __connman_wispr_start(service, type);
-               }
                break;
        case CONNMAN_SERVICE_STATE_ONLINE:
                break;
@@ -6931,41 +8024,26 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
                        service_rp_filter(service, false);
 
                break;
-       case CONNMAN_SERVICE_STATE_FAILURE:
-               break;
-       }
 
-       /* Keep that state, but if the ipconfig method is OFF, then we set
-          the state to IDLE so that it will not affect the combined state
-          in the future.
-        */
-       method = __connman_ipconfig_get_method(ipconfig);
-       switch (method) {
-       case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
-       case CONNMAN_IPCONFIG_METHOD_OFF:
-               new_state = CONNMAN_SERVICE_STATE_IDLE;
-               break;
+       case CONNMAN_SERVICE_STATE_IDLE:
+       case CONNMAN_SERVICE_STATE_FAILURE:
+               __connman_ipconfig_disable(ipconfig);
 
-       case CONNMAN_IPCONFIG_METHOD_FIXED:
-       case CONNMAN_IPCONFIG_METHOD_MANUAL:
-       case CONNMAN_IPCONFIG_METHOD_DHCP:
-       case CONNMAN_IPCONFIG_METHOD_AUTO:
                break;
-
        }
 
-       if (is_connected_state(service, old_state) &&
-                       !is_connected_state(service, new_state))
-               nameserver_remove_all(service);
+       if (is_connected(old_state) && !is_connected(new_state))
+               nameserver_remove_all(service, type);
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                service->state_ipv4 = new_state;
        else
                service->state_ipv6 = new_state;
 
-       if (!is_connected_state(service, old_state) &&
-                       is_connected_state(service, new_state))
-               nameserver_add_all(service);
+       if (!is_connected(old_state) && is_connected(new_state))
+               nameserver_add_all(service, type);
+
+       __connman_timeserver_sync(service);
 
 #if defined TIZEN_EXT
        int ret = service_indicate_state(service);
@@ -7024,10 +8102,31 @@ static void prepare_8021x(struct connman_service *service)
                connman_network_set_string(service->network, "WiFi.Identity",
                                                        service->identity);
 
+       if (service->anonymous_identity)
+               connman_network_set_string(service->network,
+                                               "WiFi.AnonymousIdentity",
+                                               service->anonymous_identity);
+
        if (service->ca_cert_file)
                connman_network_set_string(service->network, "WiFi.CACertFile",
                                                        service->ca_cert_file);
 
+       if (service->subject_match)
+               connman_network_set_string(service->network, "WiFi.SubjectMatch",
+                                                       service->subject_match);
+
+       if (service->altsubject_match)
+               connman_network_set_string(service->network, "WiFi.AltSubjectMatch",
+                                                       service->altsubject_match);
+
+       if (service->domain_suffix_match)
+               connman_network_set_string(service->network, "WiFi.DomainSuffixMatch",
+                                                       service->domain_suffix_match);
+
+       if (service->domain_match)
+               connman_network_set_string(service->network, "WiFi.DomainMatch",
+                                                       service->domain_match);
+
        if (service->client_cert_file)
                connman_network_set_string(service->network,
                                                "WiFi.ClientCertFile",
@@ -7046,6 +8145,17 @@ static void prepare_8021x(struct connman_service *service)
        if (service->phase2)
                connman_network_set_string(service->network, "WiFi.Phase2",
                                                        service->phase2);
+
+#if defined TIZEN_EXT
+       if (service->keymgmt_type)
+               connman_network_set_string(service->network, "WiFi.KeymgmtType",
+                                                       service->keymgmt_type);
+
+       DBG("service->phase1 : %s", service->phase1);
+       if (service->phase1)
+               connman_network_set_string(service->network, "WiFi.Phase1",
+                                                       service->phase1);
+#endif
 }
 
 static int service_connect(struct connman_service *service)
@@ -7067,7 +8177,7 @@ static int service_connect(struct connman_service *service)
                if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
                        break;
 
-               if (!is_connecting(temp) && !is_connected(temp))
+               if (!is_connecting(temp->state) && !is_connected(temp->state))
                        break;
 
                if (service == temp)
@@ -7087,6 +8197,9 @@ static int service_connect(struct connman_service *service)
        case CONNMAN_SERVICE_TYPE_SYSTEM:
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                return -EINVAL;
        case CONNMAN_SERVICE_TYPE_ETHERNET:
        case CONNMAN_SERVICE_TYPE_GADGET:
@@ -7103,6 +8216,9 @@ static int service_connect(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        if (service->error == CONNMAN_SERVICE_ERROR_INVALID_KEY)
                                return -ENOKEY;
 
@@ -7130,9 +8246,13 @@ static int service_connect(struct connman_service *service)
                         * or EAP-AKA (EAP-TLS, EAP-SIM and EAP-AKA networks
                         * need to be fully provisioned)
                         */
+                       DBG("service eap: %s", service->eap);
                        if (g_str_equal(service->eap, "tls") ||
                                g_str_equal(service->eap, "sim") ||
-                               g_str_equal(service->eap, "aka"))
+                               g_str_equal(service->eap, "aka") ||
+                               g_str_equal(service->eap, "aka'") ||
+                               g_str_equal(service->eap, "pwd") ||
+                               g_str_equal(service->eap, "fast"))
                                break;
 #else
                        /*
@@ -7169,6 +8289,9 @@ static int service_connect(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
+#if defined TIZEN_EXT
+               case CONNMAN_SERVICE_SECURITY_SAE:
+#endif
                        break;
                case CONNMAN_SERVICE_SECURITY_8021X:
                        prepare_8021x(service);
@@ -7182,22 +8305,22 @@ static int service_connect(struct connman_service *service)
                                                &service->stats_roaming.data);
                }
 
-               if (service->ipconfig_ipv4)
-                       __connman_ipconfig_enable(service->ipconfig_ipv4);
-               if (service->ipconfig_ipv6)
-                       __connman_ipconfig_enable(service->ipconfig_ipv6);
-
                err = __connman_network_connect(service->network);
        } else if (service->type == CONNMAN_SERVICE_TYPE_VPN &&
                                        service->provider)
-               err = __connman_provider_connect(service->provider);
+               err = __connman_provider_connect(service->provider,
+                                               get_dbus_sender(service));
        else
                return -EOPNOTSUPP;
 
        if (err < 0) {
                if (err != -EINPROGRESS) {
-                       __connman_ipconfig_disable(service->ipconfig_ipv4);
-                       __connman_ipconfig_disable(service->ipconfig_ipv6);
+                       __connman_service_ipconfig_indicate_state(service,
+                                               CONNMAN_SERVICE_STATE_FAILURE,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+                       __connman_service_ipconfig_indicate_state(service,
+                                               CONNMAN_SERVICE_STATE_FAILURE,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
                        __connman_stats_service_unregister(service);
                }
        }
@@ -7215,10 +8338,10 @@ int __connman_service_connect(struct connman_service *service,
                reason2string(service->connect_reason),
                reason2string(reason));
 
-       if (is_connected(service))
+       if (is_connected(service->state))
                return -EISCONN;
 
-       if (is_connecting(service))
+       if (is_connecting(service->state))
                return -EALREADY;
 
        switch (service->type) {
@@ -7226,6 +8349,9 @@ int __connman_service_connect(struct connman_service *service,
        case CONNMAN_SERVICE_TYPE_SYSTEM:
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                return -EINVAL;
 
        case CONNMAN_SERVICE_TYPE_ETHERNET:
@@ -7244,6 +8370,8 @@ int __connman_service_connect(struct connman_service *service,
 
        err = service_connect(service);
 
+       DBG("service %p err %d", service, err);
+
        service->connect_reason = reason;
        if (err >= 0)
                return 0;
@@ -7265,6 +8393,7 @@ int __connman_service_connect(struct connman_service *service,
        if (service->connect_reason == CONNMAN_SERVICE_CONNECT_REASON_USER) {
                if (err == -ENOKEY || err == -EPERM) {
                        DBusMessage *pending = NULL;
+                       const char *dbus_sender = get_dbus_sender(service);
 
                        /*
                         * We steal the reply here. The idea is that the
@@ -7279,7 +8408,7 @@ int __connman_service_connect(struct connman_service *service,
 
                        err = __connman_agent_request_passphrase_input(service,
                                        request_input_cb,
-                                       get_dbus_sender(service),
+                                       dbus_sender,
                                        pending);
                        if (service->hidden && err != -EINPROGRESS)
                                service->pending = pending;
@@ -7361,7 +8490,7 @@ int __connman_service_disconnect_all(void)
        for (iter = service_list; iter; iter = iter->next) {
                service = iter->data;
 
-               if (!is_connected(service))
+               if (!is_connected(service->state))
                        break;
 
                services = g_slist_prepend(services, service);
@@ -7391,6 +8520,11 @@ static struct connman_service *lookup_by_identifier(const char *identifier)
        return g_hash_table_lookup(service_hash, identifier);
 }
 
+struct connman_service *connman_service_lookup_from_identifier(const char* identifier)
+{
+       return lookup_by_identifier(identifier);
+}
+
 struct provision_user_data {
        const char *ident;
        int ret;
@@ -7490,8 +8624,15 @@ static int service_register(struct connman_service *service)
 
        DBG("path %s", service->path);
 
+#if defined TIZEN_EXT
+       service_load(service);
+       int ret = __connman_config_provision_service(service);
+       if (ret < 0)
+               DBG("Failed to provision service");
+#else
        if (__connman_config_provision_service(service) < 0)
                service_load(service);
+#endif
 
        g_dbus_register_interface(connection, service->path,
                                        CONNMAN_SERVICE_INTERFACE,
@@ -7541,12 +8682,6 @@ static void service_lower_down(struct connman_ipconfig *ipconfig,
 
        DBG("%s lower down", ifname);
 
-       if (!is_idle_state(service, service->state_ipv4))
-               __connman_ipconfig_disable(service->ipconfig_ipv4);
-
-       if (!is_idle_state(service, service->state_ipv6))
-               __connman_ipconfig_disable(service->ipconfig_ipv6);
-
        stats_stop(service);
        service_save(service);
 }
@@ -7557,6 +8692,9 @@ 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;
+#if defined TIZEN_EXT
+       int err;
+#endif
 
        DBG("%s ip bound", ifname);
 
@@ -7568,11 +8706,21 @@ static void service_ip_bound(struct connman_ipconfig *ipconfig,
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
                        method == CONNMAN_IPCONFIG_METHOD_AUTO)
+#if defined TIZEN_EXT
+       {
+               err = __connman_ipconfig_gateway_add(ipconfig, service);
+
+               if(err < 0)
+                       DBG("Failed to add gateway");
+       }
+#else
                __connman_service_ipconfig_indicate_state(service,
                                                CONNMAN_SERVICE_STATE_READY,
                                                CONNMAN_IPCONFIG_TYPE_IPV6);
+#endif
 
        settings_changed(service, ipconfig);
+       address_updated(service, type);
 }
 
 static void service_ip_release(struct connman_ipconfig *ipconfig,
@@ -7815,8 +8963,15 @@ unsigned int __connman_service_get_order(struct connman_service *service)
                        service->do_split_routing == FALSE)
                order = 10;
        else if (service->type == CONNMAN_SERVICE_TYPE_WIFI) {
+#if defined TIZEN_MAINTAIN_ONLINE
+               if (service->state != CONNMAN_SERVICE_STATE_ONLINE)
+                       service->order = 0;
+               else if (service->order < 5)
+                       service->order = 5;
+#else
                if (service->order < 5)
                        order = 5;
+#endif
        } else if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET)
                order = 4;
        else if (service->type == CONNMAN_SERVICE_TYPE_BLUETOOTH)
@@ -7847,12 +9002,6 @@ unsigned int __connman_service_get_order(struct connman_service *service)
        return order;
 }
 
-void __connman_service_update_ordering(void)
-{
-       if (service_list && service_list->next)
-               service_list = g_list_sort(service_list, service_compare);
-}
-
 static enum connman_service_type convert_network_type(struct connman_network *network)
 {
        enum connman_network_type type = connman_network_get_type(network);
@@ -7894,6 +9043,8 @@ static enum connman_service_security convert_wifi_security(const char *security)
        else if (g_str_equal(security, "rsn"))
                return CONNMAN_SERVICE_SECURITY_RSN;
 #if defined TIZEN_EXT
+       else if (g_str_equal(security, "sae"))
+               return CONNMAN_SERVICE_SECURITY_SAE;
        else if (g_str_equal(security, "ft_psk") == TRUE)
                return CONNMAN_SERVICE_SECURITY_PSK;
        else if (g_str_equal(security, "ft_ieee8021x") == TRUE)
@@ -7903,6 +9054,20 @@ static enum connman_service_security convert_wifi_security(const char *security)
                return CONNMAN_SERVICE_SECURITY_UNKNOWN;
 }
 
+#if defined TIZEN_EXT
+int check_passphrase_ext(struct connman_network *network,
+                                       const char *passphrase)
+{
+       const char *str;
+       enum connman_service_security security;
+
+       str = connman_network_get_string(network, "WiFi.Security");
+       security = convert_wifi_security(str);
+
+       return __connman_service_check_passphrase(security, passphrase);
+}
+#endif
+
 static void update_from_network(struct connman_service *service,
                                        struct connman_network *network)
 {
@@ -7911,10 +9076,10 @@ static void update_from_network(struct connman_service *service,
 
        DBG("service %p network %p", service, network);
 
-       if (is_connected(service))
+       if (is_connected(service->state))
                return;
 
-       if (is_connecting(service))
+       if (is_connecting(service->state))
                return;
 
        str = connman_network_get_string(network, "Name");
@@ -8025,6 +9190,9 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
        case CONNMAN_SERVICE_TYPE_WIFI:
        case CONNMAN_SERVICE_TYPE_CELLULAR:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                break;
        case CONNMAN_SERVICE_TYPE_ETHERNET:
                service->favorite = true;
@@ -8046,6 +9214,7 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
                service->ipconfig_ipv6 = create_ip6config(service, index);
 
        service_register(service);
+       service_schedule_added(service);
 
        if (service->favorite) {
                device = connman_network_get_device(service->network);
@@ -8055,6 +9224,9 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
                        case CONNMAN_SERVICE_TYPE_UNKNOWN:
                        case CONNMAN_SERVICE_TYPE_SYSTEM:
                        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+                       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                                break;
 
                        case CONNMAN_SERVICE_TYPE_GADGET:
@@ -8091,7 +9263,6 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
        }
 
        __connman_notifier_service_add(service, service->name);
-       service_schedule_added(service);
 
        return service;
 }
@@ -8354,6 +9525,8 @@ int __connman_service_init(void)
                return err;
        }
 
+       set_always_connecting_technologies();
+
        connection = connman_dbus_get_connection();
 
        service_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -8397,9 +9570,10 @@ void __connman_service_cleanup(void)
        if (services_notify->id != 0) {
                g_source_remove(services_notify->id);
                service_send_changed(NULL);
-               g_hash_table_destroy(services_notify->remove);
-               g_hash_table_destroy(services_notify->add);
        }
+
+       g_hash_table_destroy(services_notify->remove);
+       g_hash_table_destroy(services_notify->add);
        g_free(services_notify);
 
        dbus_connection_unref(connection);