Apply DNS configuration method 87/118887/4 accepted/tizen/common/20170322.153711 accepted/tizen/ivi/20170322.235801 accepted/tizen/mobile/20170322.235633 accepted/tizen/tv/20170322.235708 accepted/tizen/unified/20170322.235830 accepted/tizen/wearable/20170322.235735 submit/tizen/20170322.011410
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 14 Mar 2017 10:31:33 +0000 (19:31 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 14 Mar 2017 11:09:50 +0000 (20:09 +0900)
Change-Id: If16e739fde7e9d736c66015ab1efa982e49d3482
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
plugins/telephony.c
src/config.c
src/connman.h
src/dhcp.c
src/dhcpv6.c
src/ipconfig.c
src/network.c
src/provider.c
src/resolver.c
src/rtnl.c
src/service.c

index 459095d..2b4c5a4 100755 (executable)
@@ -1207,11 +1207,20 @@ static gboolean __set_network_context(
                                                ipv4_netmask, ipv4_gw);
 
        if (ipv4_dns1)
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(service, ipv4_dns1, FALSE,
+                               CONNMAN_IPCONFIG_TYPE_IPV4);
+#else
                __connman_service_nameserver_append(service, ipv4_dns1, FALSE);
+#endif
        //if (ipv4_dns2)
        if (ipv4_dns2 && !ipv4_dns1)
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(service, ipv4_dns2, FALSE,
+                               CONNMAN_IPCONFIG_TYPE_IPV4);
+#else
                __connman_service_nameserver_append(service, ipv4_dns2, FALSE);
-
+#endif
        /* ipv6 set */
        if (network->ipv6_address == NULL)
                network->ipv6_address =
@@ -1237,10 +1246,20 @@ static gboolean __set_network_context(
                                                64, ipv6_gw);
 
        if (ipv6_dns1)
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(service, ipv6_dns1, FALSE,
+                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                __connman_service_nameserver_append(service, ipv6_dns1, FALSE);
+#endif
        //if (ipv6_dns2)
        if (ipv6_dns2 && !ipv6_dns1)
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(service, ipv6_dns2, FALSE,
+                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                __connman_service_nameserver_append(service, ipv6_dns2, FALSE);
+#endif
 
        if (active == TRUE &&
                        connman_network_get_connected(network->network) == TRUE) {
index 3818fb8..25dd174 100755 (executable)
@@ -1097,6 +1097,20 @@ static gboolean remove_virtual_config(gpointer user_data)
        return FALSE;
 }
 
+#if defined TIZEN_EXT
+static bool __check_address_type(int address_family, const char *address)
+{
+       unsigned char buf[sizeof(struct in6_addr)] = {0, };
+       int err = 0;
+
+       err = inet_pton(address_family, address, buf);
+       if(err > 0)
+               return TRUE;
+
+       return FALSE;
+}
+#endif
+
 static int try_provision_service(struct connman_config_service *config,
                                struct connman_service *service)
 {
@@ -1279,8 +1293,19 @@ static int try_provision_service(struct connman_config_service *config,
                __connman_service_nameserver_clear(service);
 
                for (i = 0; config->nameservers[i]; i++) {
+#if defined TIZEN_EXT
+                       if (__check_address_type(AF_INET, config->nameservers[i]))
+                               __connman_service_nameserver_append(service,
+                                               config->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+                       else if (__check_address_type(AF_INET6, config->nameservers[i]))
+                               __connman_service_nameserver_append(service,
+                                               config->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                        __connman_service_nameserver_append(service,
                                                config->nameservers[i], false);
+#endif
                }
        }
 
index 077bc1c..499f38d 100755 (executable)
@@ -758,10 +758,19 @@ const char *__connman_service_type2string(enum connman_service_type type);
 enum connman_service_type __connman_service_string2type(const char *str);
 enum connman_service_security __connman_service_string2security(const char *str);
 
+#if defined TIZEN_EXT
+int __connman_service_nameserver_append(struct connman_service *service,
+                               const char *nameserver, bool is_auto,
+                               enum connman_ipconfig_type type);
+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_append(struct connman_service *service,
                                const char *nameserver, bool is_auto);
 int __connman_service_nameserver_remove(struct connman_service *service,
                                const char *nameserver, bool is_auto);
+#endif
 void __connman_service_nameserver_clear(struct connman_service *service);
 void __connman_service_nameserver_add_routes(struct connman_service *service,
                                                const char *gw);
@@ -895,6 +904,11 @@ unsigned int __connman_rtnl_update_interval_remove(unsigned int interval);
 int __connman_rtnl_request_update(void);
 int __connman_rtnl_send(const void *buf, size_t len);
 
+#if defined TIZEN_EXT
+void rtnl_nameserver_add_all(struct connman_service *service,
+                       enum connman_ipconfig_type type);
+#endif
+
 bool __connman_session_policy_autoconnect(enum connman_service_connect_reason reason);
 
 int __connman_session_create(DBusMessage *msg);
index 7ca19d0..5b0beab 100755 (executable)
@@ -111,8 +111,14 @@ static bool apply_dhcp_invalidate_on_network(struct connman_dhcp *dhcp)
        }
        if (dhcp->nameservers) {
                for (i = 0; dhcp->nameservers[i]; i++) {
+#if defined TIZEN_EXT
+                       __connman_service_nameserver_remove(service,
+                                               dhcp->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+#else
                        __connman_service_nameserver_remove(service,
                                                dhcp->nameservers[i], false);
+#endif
                }
        }
 
@@ -359,18 +365,32 @@ static bool apply_lease_available_on_network(GDHCPClient *dhcp_client,
 
        if (!compare_string_arrays(nameservers, dhcp->nameservers)) {
                if (dhcp->nameservers) {
+#if defined TIZEN_EXT
+                       for (i = 0; dhcp->nameservers[i] != NULL; i++) {
+                               __connman_service_nameserver_remove(service,
+                                               dhcp->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+                       }
+#else
                        for (i = 0; dhcp->nameservers[i]; i++) {
                                __connman_service_nameserver_remove(service,
                                                dhcp->nameservers[i], false);
                        }
+#endif
                        g_strfreev(dhcp->nameservers);
                }
 
                dhcp->nameservers = nameservers;
 
                for (i = 0; dhcp->nameservers && dhcp->nameservers[i]; i++) {
+#if defined TIZEN_EXT
+                       __connman_service_nameserver_append(service,
+                                               dhcp->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+#else
                        __connman_service_nameserver_append(service,
                                                dhcp->nameservers[i], false);
+#endif
                }
        } else {
                g_strfreev(nameservers);
index db9feb6..3d66ef3 100755 (executable)
@@ -327,9 +327,19 @@ static void info_req_cb(GDHCPClient *dhcp_client, gpointer user_data)
        if (!compare_string_arrays(nameservers, dhcp->nameservers)) {
                if (dhcp->nameservers) {
                        for (i = 0; dhcp->nameservers[i]; i++)
+#if defined TIZEN_EXT
+                       {
                                __connman_service_nameserver_remove(service,
-                                                       dhcp->nameservers[i],
-                                                       false);
+                                               dhcp->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
+                               __connman_service_nameserver_remove(service,
+                                               dhcp->nameservers[i],
+                                               false);
+#endif
+#if defined TIZEN_EXT
+                       }
+#endif
                        g_strfreev(dhcp->nameservers);
                }
 
@@ -337,9 +347,19 @@ static void info_req_cb(GDHCPClient *dhcp_client, gpointer user_data)
 
                for (i = 0; dhcp->nameservers &&
                                        dhcp->nameservers[i]; i++)
+#if defined TIZEN_EXT
+               {
+                       __connman_service_nameserver_append(service,
+                                               dhcp->nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                        __connman_service_nameserver_append(service,
                                                dhcp->nameservers[i],
                                                false);
+#endif
+#if defined TIZEN_EXT
+               }
+#endif
        } else
                g_strfreev(nameservers);
 
@@ -522,9 +542,19 @@ static int set_other_addresses(GDHCPClient *dhcp_client,
        if (!compare_string_arrays(nameservers, dhcp->nameservers)) {
                if (dhcp->nameservers) {
                        for (i = 0; dhcp->nameservers[i]; i++)
+#if defined TIZEN_EXT
+                       {
+                               __connman_service_nameserver_remove(service,
+                                               dhcp->nameservers[i],
+                                               false, CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
                                __connman_service_nameserver_remove(service,
                                                        dhcp->nameservers[i],
                                                        false);
+#endif
+#if defined TIZEN_EXT
+                       }
+#endif
                        g_strfreev(dhcp->nameservers);
                }
 
@@ -532,9 +562,19 @@ static int set_other_addresses(GDHCPClient *dhcp_client,
 
                for (i = 0; dhcp->nameservers &&
                                        dhcp->nameservers[i]; i++)
+#if defined TIZEN_EXT
+               {
                        __connman_service_nameserver_append(service,
-                                                       dhcp->nameservers[i],
-                                                       false);
+                                       dhcp->nameservers[i],
+                                       false, CONNMAN_IPCONFIG_TYPE_IPV6);
+#else
+                       __connman_service_nameserver_append(service,
+                                               dhcp->nameservers[i],
+                                               false);
+#endif
+#if defined TIZEN_EXT
+               }
+#endif
        } else
                g_strfreev(nameservers);
 
index c178eb5..27d98b2 100755 (executable)
@@ -1964,9 +1964,7 @@ void __connman_ipconfig_append_ipv6config(struct connman_ipconfig *ipconfig,
 {
        const char *str, *privacy;
 
-#if !defined TIZEN_EXT
        DBG("");
-#endif
 
        str = __connman_ipconfig_method2string(ipconfig->method);
        if (!str)
@@ -2010,9 +2008,7 @@ void __connman_ipconfig_append_ipv4config(struct connman_ipconfig *ipconfig,
 {
        const char *str;
 
-#if !defined TIZEN_EXT
        DBG("");
-#endif
 
        str = __connman_ipconfig_method2string(ipconfig->method);
        if (!str)
index 7fc954a..2585841 100755 (executable)
@@ -2041,8 +2041,14 @@ int connman_network_set_nameservers(struct connman_network *network,
        nameservers_array = g_strsplit(nameservers, " ", 0);
 
        for (i = 0; nameservers_array[i]; i++) {
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(service,
+                                               nameservers_array[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                __connman_service_nameserver_append(service,
                                                nameservers_array[i], false);
+#endif
        }
 
        g_strfreev(nameservers_array);
index 22ff08a..521346b 100755 (executable)
@@ -576,8 +576,14 @@ int connman_provider_set_nameservers(struct connman_provider *provider,
                return 0;
 
        for (i = 0; nameservers[i]; i++)
+#if defined TIZEN_EXT
+               __connman_service_nameserver_append(provider->vpn_service,
+                                               nameservers[i], false,
+                                               CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                __connman_service_nameserver_append(provider->vpn_service,
                                                nameservers[i], false);
+#endif
 
        return 0;
 }
index fae02a8..8a7fa66 100755 (executable)
@@ -301,8 +301,14 @@ static gboolean resolver_expire_cb(gpointer user_data)
                struct connman_service *service;
                service = __connman_service_lookup_from_index(entry->index);
                if (service)
+#if defined TIZEN_EXT
+                       __connman_service_nameserver_remove(service,
+                                       entry->server, true,
+                                       CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                        __connman_service_nameserver_remove(service,
                                                        entry->server, true);
+#endif
        }
 
        remove_entries(list);
@@ -392,8 +398,14 @@ static int append_resolver(int index, const char *domain,
                        struct connman_service *service;
                        service = __connman_service_lookup_from_index(entry->index);
                        if (service)
+#if defined TIZEN_EXT
+                               __connman_service_nameserver_append(service,
+                                               server, true,
+                                               CONNMAN_IPCONFIG_TYPE_ALL);
+#else
                                __connman_service_nameserver_append(service,
                                                                server, true);
+#endif
                }
        }
 
index 42ebd4a..5f5cea5 100755 (executable)
@@ -1324,17 +1324,30 @@ static void rtnl_newnduseropt(struct nlmsghdr *hdr)
 
                if (opt->nd_opt_type == 25) { /* ND_OPT_RDNSS */
                        char buf[40];
+#if defined TIZEN_EXT
+                       struct connman_service *service;
 
+                       service = __connman_service_lookup_from_index(index);
+                       DBG("service: %p\n",service);
+#endif
                        servers = rtnl_nd_opt_rdnss(opt, &lifetime,
-                                                               &nr_servers);
+                                       &nr_servers);
                        for (i = 0; i < nr_servers; i++) {
                                if (!inet_ntop(AF_INET6, servers + i, buf,
-                                                               sizeof(buf)))
+                                                       sizeof(buf)))
                                        continue;
 
+#if defined TIZEN_EXT
+                               __connman_service_nameserver_append(service,
+                                               buf, false,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+#endif
                                connman_resolver_append_lifetime(index,
-                                                       NULL, buf, lifetime);
+                                               NULL, buf, lifetime);
                        }
+#if defined TIZEN_EXT
+                       rtnl_nameserver_add_all(service, CONNMAN_IPCONFIG_TYPE_IPV6);
+#endif
 
                } else if (opt->nd_opt_type == 31) { /* ND_OPT_DNSSL */
                        g_free(domains);
index 6ac6f6c..ed3235c 100755 (executable)
@@ -166,7 +166,8 @@ struct connman_service {
        int disconnect_reason;
 #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
 };
 
@@ -756,11 +757,14 @@ 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);
+       service->dns_config_method_ipv4 = __connman_dnsconfig_string2method(dns_method);
+
+       dns_method = g_key_file_get_string(keyfile, service->identifier,
+                       "Nameservers.IPv6method", NULL);
+       service->dns_config_method_ipv6 = __connman_dnsconfig_string2method(dns_method);
 #endif
 
        service->timeservers_config = g_key_file_get_string_list(keyfile,
@@ -999,18 +1003,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) {
@@ -1332,25 +1344,137 @@ static int nameserver_add(struct connman_service *service,
        if (index < 0)
                return -ENXIO;
 
+#if defined TIZEN_EXT
+       DBG("Resolver append nameserver: %s", nameserver);
+#endif
        return connman_resolver_append(index, NULL, nameserver);
 }
 
+#if defined TIZEN_EXT
+static int nameserver_add_all(struct connman_service *service,
+               enum connman_ipconfig_type type)
+#else
 static int nameserver_add_all(struct connman_service *service)
+#endif
 {
        int i = 0;
 
        if (service->nameservers_config) {
                while (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) {
+                               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,
+                                                      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,
+                                                      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,
+                                                      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,
+                                                      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, service->nameservers_config[i]);
+#endif
                        i++;
                }
-
+#if !defined TIZEN_EXT
                return 0;
+#endif
        }
 
+#if defined TIZEN_EXT
+       i = 0;
+#endif
        if (service->nameservers) {
                while (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,
+                                                      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,
+                                                      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,
+                                                      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,
+                                                      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, service->nameservers[i]);
+#endif
                        i++;
                }
        }
@@ -1373,7 +1497,12 @@ static int nameserver_remove(struct connman_service *service,
        return connman_resolver_remove(index, NULL, nameserver);
 }
 
+#if defined TIZEN_EXT
+static int nameserver_remove_all(struct connman_service *service,
+               enum connman_ipconfig_type type)
+#else
 static int nameserver_remove_all(struct connman_service *service)
+#endif
 {
 #if defined TIZEN_EXT
        /**
@@ -1391,20 +1520,138 @@ static int nameserver_remove_all(struct connman_service *service)
                return -ENXIO;
 
        while (service->nameservers_config && 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,
+                                                 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,
+                                                 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,
+                                                 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,
+                                                 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, service->nameservers_config[i]);
+#endif
                i++;
        }
 
        i = 0;
        while (service->nameservers && service->nameservers[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,
+                                                         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,
+                                                         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,
+                                                         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,
+                                                         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_remove(service, service->nameservers[i]);
+#endif
                i++;
        }
 
        return 0;
 }
 
+#if defined TIZEN_EXT
+void rtnl_nameserver_add_all(struct connman_service *service,
+               enum connman_ipconfig_type type)
+{
+       DBG("");
+       nameserver_add_all(service, type);
+}
+#endif
+
 static int searchdomain_add_all(struct connman_service *service)
 {
        int index, i = 0;
@@ -1460,13 +1707,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 +1730,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);
@@ -1498,23 +1758,38 @@ int __connman_service_nameserver_append(struct connman_service *service,
        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;
+#if defined TIZEN_EXT
+               DBG("nameserver add: %s, type: %d", nameserver, type);
+#endif
                nameserver_add(service, nameserver);
        }
 
        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;
@@ -1580,12 +1855,23 @@ set_servers:
 
 void __connman_service_nameserver_clear(struct connman_service *service)
 {
+#if defined TIZEN_EXT
+       DBG("nameserver remove all ip_type: CONNMAN_IPCONFIG_TYPE_ALL");
+       nameserver_remove_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
+#else
        nameserver_remove_all(service);
+#endif
 
        g_strfreev(service->nameservers);
        service->nameservers = NULL;
 
+#if defined TIZEN_EXT
+       DBG("nameserver add all ip_type: CONNMAN_IPCONFIG_TYPE_ALL");
+       nameserver_add_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
+#else
        nameserver_add_all(service);
+#endif
+
 }
 
 static void add_nameserver_route(int family, int index, char *nameserver,
@@ -2112,31 +2398,141 @@ 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, 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, 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))
                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 +2557,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)
@@ -2806,12 +3227,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);
@@ -3841,6 +4260,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)
@@ -3863,22 +4286,55 @@ static DBusMessage *set_property(DBusConnection *conn,
 
                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) {
@@ -3889,7 +4345,21 @@ static DBusMessage *set_property(DBusConnection *conn,
                        }
                }
 
+#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);
+
+               DBG("%s ip_type: %d nameserver remove all", name, ip_type);
+               nameserver_remove_all(service, ip_type);
+#else
                nameserver_remove_all(service);
+#endif
                g_strfreev(service->nameservers_config);
 
                if (str->len > 0) {
@@ -3904,7 +4374,12 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (gw && strlen(gw))
                        __connman_service_nameserver_add_routes(service, gw);
 
+#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);
+#endif
                dns_configuration_changed(service);
 
                if (__connman_service_is_connected_state(service,
@@ -4867,6 +5342,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);
@@ -6956,7 +7440,16 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
 
        if (is_connected_state(service, old_state) &&
                        !is_connected_state(service, new_state))
+#if defined TIZEN_EXT
+       {
+               DBG("nameserver remove all, type: %d", type);
+               nameserver_remove_all(service, type);
+#else
                nameserver_remove_all(service);
+#endif
+#if defined TIZEN_EXT
+       }
+#endif
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                service->state_ipv4 = new_state;
@@ -6965,7 +7458,16 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
 
        if (!is_connected_state(service, old_state) &&
                        is_connected_state(service, new_state))
+#if defined TIZEN_EXT
+       {
+               DBG("nameserver add all, type: %d", type);
+               nameserver_add_all(service, type);
+#else
                nameserver_add_all(service);
+#endif
+#if defined TIZEN_EXT
+       }
+#endif
 
 #if defined TIZEN_EXT
        int ret = service_indicate_state(service);