+#if defined TIZEN_DEBUG_ENABLE
+ g_object_unref(tcpdump_object);
+#endif
+}
+
+static gboolean __netconfig_check_ipv6_address(const char *address)
+{
+ unsigned char buf[sizeof(struct in6_addr)];
+ int err;
+
+ if (!address)
+ return FALSE;
+
+ err = inet_pton(AF_INET6, address, buf);
+ if (err > 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+char *netconfig_get_connected_cellular_internet_ipv6only_profile(struct clatd_ctrl_hint *hint)
+{
+ GVariant *message = NULL;
+ GVariantIter *iter = NULL;
+ GVariantIter *next = NULL;
+ gchar *cellular_internet_profile = NULL;
+ gchar *object_path = NULL;
+
+ message = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
+ CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
+ "GetServices", NULL);
+ if (message == NULL) {
+ ERR("Failed to get profiles");
+ return NULL;
+ }
+
+ g_variant_get(message, "(a(oa{sv}))", &iter);
+ while (g_variant_iter_loop(iter, "(oa{sv})", &object_path, &next)) {
+ if (object_path == NULL)
+ continue;
+
+ if (netconfig_is_cellular_profile(object_path) == FALSE)
+ continue;
+
+ if (netconfig_is_cellular_internet_profile(object_path) == FALSE)
+ continue;
+
+ if (__netconfig_is_connected(next) == TRUE) {
+ DBG("found connected profiles");
+ gchar *key = NULL;
+ gboolean has_v4 = FALSE, has_v6 = FALSE;
+
+ GVariant *variant = NULL;
+ while (g_variant_iter_loop(next, "{sv}", &key, &variant)) {
+ if (g_strcmp0(key, "IPv4") == 0) {
+ GVariantIter *ipv4_iter = NULL;
+ GVariant *ipv4_variant = NULL;
+ gchar *ipv4_key = NULL;
+ const gchar *ipv4_value = NULL;
+ g_variant_get(variant, "a{sv}", &ipv4_iter);
+ while (g_variant_iter_loop(ipv4_iter, "{sv}",
+ &ipv4_key, &ipv4_variant)) {
+ if (g_strcmp0(ipv4_key, "Address") == 0) {
+ ipv4_value = g_variant_get_string(ipv4_variant, NULL);
+ DBG("ipv4: %s", ipv4_value);
+ has_v4 = TRUE;
+ }
+ }
+ g_variant_iter_free (ipv4_iter);
+ } else if (g_strcmp0(key, "IPv6") == 0) {
+ GVariantIter *ipv6_iter = NULL;
+ GVariant *ipv6_variant = NULL;
+ gchar *ipv6_key = NULL;
+ const gchar *ipv6_value = NULL;
+ g_variant_get(variant, "a{sv}", &ipv6_iter);
+ while (g_variant_iter_loop(ipv6_iter, "{sv}",
+ &ipv6_key, &ipv6_variant)) {
+ if (g_strcmp0(ipv6_key, "Address") == 0) {
+ ipv6_value = g_variant_get_string(ipv6_variant, NULL);
+ DBG("ipv6: %s", ipv6_value);
+ has_v6 = TRUE;
+ }
+ }
+ g_variant_iter_free (ipv6_iter);
+ } else if (hint && g_strcmp0(key, "Nameservers") == 0) {
+ int idx = 0;
+ GVariantIter *ns_iter = NULL;
+ gchar *nameserver = NULL;
+ g_variant_get(variant, "as", &ns_iter);
+ while(g_variant_iter_loop(ns_iter, "s", &nameserver)) {
+ INFO("nameserver[%d]: %s", idx, nameserver);
+ if (idx >= MAX_DNS) {
+ INFO("index exceeded %d -- skip", idx);
+ continue;
+ }
+ if (__netconfig_check_ipv6_address(nameserver) == TRUE) {
+ hint->nameserver[idx] = g_strdup(nameserver);
+ idx++;
+ } else {
+ INFO("malformed address %s -- skip", nameserver);
+ }
+ }
+ }
+ }
+
+ if (!has_v4 && has_v6) {
+ DBG("found 'ipv6-only/connected/internet cellular profile'");
+ cellular_internet_profile = g_strdup(object_path);
+ g_free(object_path);
+ g_variant_iter_free(next);
+ break;
+ }
+ }
+ }
+ g_variant_iter_free(iter);
+ g_variant_unref(message);
+
+ return cellular_internet_profile;