char *_get_ipv6_network_interface(void);
char *_get_ipv6_network_address(void);
char *_get_ipv6_network_prefix(void);
+char *_get_ipv6_network_dns_address(void);
gboolean _get_ipv6_network_state(void);
int _open_ipv6_network(void);
void _close_ipv6_network(void);
gboolean _get_network_interface_name(char **if_name);
gboolean _get_network_gateway_address(mobile_ap_address_type_e address_type, char **ip);
+gboolean _get_network_dns_address(mobile_ap_address_type_e address_type, char **dns);
gboolean _is_trying_network_operation(void);
gboolean _set_masquerade(void);
gboolean _unset_masquerade(void);
char *if_name;
char *global_address;
char *prefix;
+ char *dns;
gboolean state;
} ipv6_network_info_s;
-static ipv6_network_info_s ipv6_net_info = {NULL, NULL, NULL, FALSE};
+static ipv6_network_info_s ipv6_net_info = {NULL, NULL, NULL, NULL, FALSE};
gboolean _set_ipv6_masquerade(void);
gboolean _unset_ipv6_masquerade(void);
#endif
return TRUE;
}
+gboolean _get_network_dns_address(mobile_ap_address_type_e address_type, char **dns)
+{
+ if (dns == NULL) {
+ ERR("dns is NULL\n");
+ return FALSE;
+ }
+
+ if (tethered_prof == NULL)
+ return FALSE;
+
+ int ret = 0;
+
+ connection_profile_refresh(tethered_prof);
+
+ ret = connection_profile_get_dns_address(tethered_prof, 1, address_type, dns);
+ if (ret != CONNECTION_ERROR_NONE) {
+ ERR("connection_profile_get_dns_address is failed : 0x%X\n", ret);
+ return FALSE;
+ }
+
+ if (strlen(*dns) == 0) {
+ ERR("dns is zero length\n");
+ free(*dns);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
gboolean _set_masquerade(void)
{
char *if_name = NULL;
{
char *if_name = NULL;
char *global_address = NULL;
+ char *dns = NULL;
char prefix[INET6_ADDRSTRLEN] = {0, };
struct sockaddr_in6 sa;
int prefix_len = 0, i = 0;
ipv6_net_info.prefix = g_strdup(prefix);
}
- DBG("Update ipv6 network info([%s][%s][%s][%d])",
+ if (_get_network_dns_address(MOBILE_AP_ADDRESS_TYPE_IPV6, &dns) == FALSE) {
+ ERR("Fail to get dns address!!");
+ g_free(dns);
+ dns = NULL;
+ }
+
+ if (dns)
+ ipv6_net_info.dns = g_strdup(dns);
+ else
+ ipv6_net_info.dns = g_strdup(ipv6_net_info.global_address);
+
+ DBG("Update ipv6 network info([%s][%s][%s][%s][%d])",
ipv6_net_info.if_name, ipv6_net_info.global_address,
- ipv6_net_info.prefix, ipv6_net_info.state);
+ ipv6_net_info.prefix, ipv6_net_info.dns, ipv6_net_info.state);
return MOBILE_AP_ERROR_NONE;
}
return ipv6_net_info.prefix;
}
+char *_get_ipv6_network_dns_address(void)
+{
+ return ipv6_net_info.dns;
+}
+
gboolean _get_ipv6_network_state(void)
{
return ipv6_net_info.state;
FILE *fp = NULL;
pid_t pid;
char *network_addr = NULL;
+ char *dns_addr = NULL;
char *prefix = NULL;
if (remove(DNSMASQ_LEASES_FILE) < 0)
return MOBILE_AP_ERROR_INTERNAL;
}
+ dns_addr = _get_ipv6_network_dns_address();
+ if (dns_addr == NULL) {
+ ERR("Failed to get DNS address");
+ fclose(fp);
+ return MOBILE_AP_ERROR_INTERNAL;
+ }
+
if (_get_ipv6_network_state()) {
prefix = g_strndup(network_addr, 19);
snprintf(buf, DNSMASQ_CONF_LEN,
prefix, prefix, prefix, prefix,
prefix, prefix, prefix, prefix,
prefix, prefix, prefix, prefix,
- prefix, prefix, network_addr);
+ prefix, prefix, dns_addr);
} else {
prefix = g_strndup(network_addr, 10);
snprintf(buf, DNSMASQ_CONF_LEN,