__connman_inet_rs_cb_t callback, void *user_data);
int __connman_inet_ipv6_send_ra(int index, struct in6_addr *src_addr,
GSList *prefixes, int router_lifetime);
+#if defined TIZEN_EXT
+void __connman_network_set_auto_ipv6_gateway(char *gateway, void *user_data);
+#endif
typedef void (*__connman_inet_ns_cb_t) (struct nd_neighbor_advert *reply,
unsigned int length,
static void ipv4ll_available_cb(GDHCPClient *ipv4ll_client, gpointer user_data)
{
struct connman_dhcp *dhcp = user_data;
-#if !defined TIZEN_EXT
char *address, *netmask;
unsigned char prefixlen;
-#endif
DBG("IPV4LL available");
-#if defined TIZEN_EXT
- /*
- * Description: When DHCP is failed,
- * most of normal users cannot understand auto-generated IP
- * (IPV4 link local) and serious troubles to make Internet connection.
- */
- dhcp_invalidate(dhcp, true);
-
- connman_network_set_error(dhcp->network,
- CONNMAN_NETWORK_ERROR_DHCP_FAIL);
-#else
address = g_dhcp_client_get_address(ipv4ll_client);
netmask = g_dhcp_client_get_netmask(ipv4ll_client);
g_free(address);
g_free(netmask);
-#endif
}
static int dhcp_initialize(struct connman_dhcp *dhcp)
remain -= label_len + 1;
}
-#if defined TIZEN_EXT
- /* parse DNS query type either A or AAAA
- * enforce to drop AAAA temporarily (IPv6 not supported)
- */
- if (last_label != NULL) {
- uint16_t *type_p = (uint16_t *)last_label;
- uint16_t type = ntohs(*type_p);
-
- if (type == 0x1c) {
- DBG("query %s is type AAAA(0x%x)", name, type);
- return -ENOENT;
- }
- }
-#endif
-
if (last_label && arcount && remain >= 9 && last_label[4] == 0 &&
!memcmp(last_label + 5, opt_edns0_type, 2)) {
uint16_t edns0_bufsize;
&ifdata->tcp6_listener_watch);
}
-#if defined TIZEN_EXT
-/* Temporarily disable AAAA type to enhance performance (IPv6 not supported) */
-static void __send_response_not_implemented(int sk, unsigned char *buf, int len,
- const struct sockaddr *to, socklen_t tolen,
- int protocol)
-{
- struct domain_hdr *hdr;
- int err, offset = protocol_offset(protocol);
-
- DBG("sk %d", sk);
-
- if (offset < 0)
- return;
-
- if (len < 12)
- return;
-
- hdr = (void *) (buf + offset);
-
- DBG("id 0x%04x qr %d opcode %d", hdr->id, hdr->qr, hdr->opcode);
-
- hdr->qr = 1;
- hdr->rcode = 4;
-
- hdr->ancount = 0;
- hdr->nscount = 0;
- hdr->arcount = 0;
-
- err = sendto(sk, buf, len, MSG_NOSIGNAL, to, tolen);
- if (err < 0)
- connman_error("Failed to send DNS response to %d: %s",
- sk, strerror(errno));
-}
-#endif
-
static bool udp_listener_event(GIOChannel *channel, GIOCondition condition,
struct listener_data *ifdata, int family,
guint *listener_watch)
err = parse_request(buf, len, query, sizeof(query));
if (err < 0 || (g_slist_length(server_list) == 0)) {
-#if defined TIZEN_EXT
- if (err == -ENOENT) {
- /* Temporarily disable AAAA type to enhance performance
- * (IPv6 not supported)
- */
- __send_response_not_implemented(sk, buf, len, client_addr,
- *client_addr_len, IPPROTO_UDP);
- return TRUE;
- }
-#endif
send_response(sk, buf, len, client_addr,
*client_addr_len, IPPROTO_UDP);
return true;
return -errno;
}
+#if defined TIZEN_EXT
+ /* Set Received Source Address from router as IPv6 Gateway Address */
+ char src_addr[INET6_ADDRSTRLEN];
+ if(inet_ntop(AF_INET6, &(saddr.sin6_addr), src_addr, INET6_ADDRSTRLEN)
+ == NULL) {
+ xs_cleanup(data);
+ return -errno;
+ }
+ DBG("Received Source Address %s from router", src_addr);
+
+ /* icmpv6_recv() function can be called in two scenarios :
+ * 1. When __connman_inet_ipv6_send_rs() is called from check_dhcpv6()
+ * 2. When __connman_inet_ipv6_send_rs() is called from
+ * __connman_6to4_probe()
+ * In the second case it is not required to set DHCPv6 Gateway Address
+ * as DHCPv6 was not started and network structure was not passed as
+ * user_data. If it is tried to add Source Address as Gateway Address
+ * then it will lead to crash because of user_data being ip_address
+ * instead of network structure. So Adding Gateway Address in case 1st
+ * case only.
+ */
+ char *address = data->user_data;
+ int err = 0;
+ unsigned char buffer[sizeof(struct in6_addr)] = {0, };
+ /* Checking if user_data is an ip_address */
+ err = inet_pton(AF_INET, address, buffer);
+ /* Setting Received Source Address from
+ * router as Gateway Address */
+ if(err <= 0)
+ __connman_network_set_auto_ipv6_gateway(src_addr, data->user_data);
+#endif
hdr = (struct nd_router_advert *)buf;
DBG("code %d len %zd hdr %zd", hdr->nd_ra_code, len,
sizeof(struct nd_router_advert));
static void __connman_ipconfig_lower_up(struct connman_ipdevice *ipdevice)
{
DBG("ipconfig ipv4 %p ipv6 %p", ipdevice->config_ipv4,
- ipdevice->config_ipv6);
+ ipdevice->config_ipv6);
+#if defined TIZEN_EXT
+ if (ipdevice->config_ipv6 != NULL &&
+ ipdevice->config_ipv6->enabled == TRUE)
+ return;
+
+ char *ifname = connman_inet_ifname(ipdevice->index);
+
+ if (__connman_device_isfiltered(ifname) == FALSE) {
+ ipdevice->ipv6_enabled = get_ipv6_state(ifname);
+ set_ipv6_state(ifname, FALSE);
+ }
+ g_free(ifname);
+#endif
}
static void __connman_ipconfig_lower_down(struct connman_ipdevice *ipdevice)
if (ipdevice->config_ipv6 == ipconfig) {
ipconfig_list = g_list_remove(ipconfig_list, ipconfig);
+#if defined TIZEN_EXT
+ if (ipdevice->config_ipv6->method ==
+ CONNMAN_IPCONFIG_METHOD_AUTO)
+ disable_ipv6(ipdevice->config_ipv6);
+#endif
connman_ipaddress_clear(ipdevice->config_ipv6->system);
__connman_ipconfig_unref(ipdevice->config_ipv6);
ipdevice->config_ipv6 = NULL;
case CONNMAN_IPCONFIG_METHOD_OFF:
ipconfig->method = method;
-
+#if defined TIZEN_EXT
+ if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6)
+ disable_ipv6(ipconfig);
+#endif
break;
case CONNMAN_IPCONFIG_METHOD_AUTO:
ipconfig->method = method;
if (privacy_string)
ipconfig->ipv6_privacy_config = privacy;
-
+#if defined TIZEN_EXT
+ enable_ipv6(ipconfig);
+#endif
break;
case CONNMAN_IPCONFIG_METHOD_MANUAL:
return 0;
}
+#if defined TIZEN_EXT
+void __connman_network_set_auto_ipv6_gateway(char *gateway, void *user_data)
+{
+ DBG("");
+
+ struct connman_network *network = user_data;
+ struct connman_service *service;
+ struct connman_ipconfig *ipconfig = NULL;
+ int err;
+
+ service = connman_service_lookup_from_network(network);
+ if (service == NULL)
+ return;
+
+ ipconfig = __connman_service_get_ipconfig(service, AF_INET6);
+ if (ipconfig == NULL)
+ return;
+
+ __connman_ipconfig_set_gateway(ipconfig, gateway);
+ err = __connman_ipconfig_gateway_add(ipconfig, service);
+
+ if(err == 0)
+ __connman_connection_gateway_activate(service,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+
+ return;
+}
+#endif
+
int __connman_network_enable_ipconfig(struct connman_network *network,
struct connman_ipconfig *ipconfig)
{