{
char http_proxy[MIDBUF] ={0}, https_proxy[MIDBUF] = {0,},
ftp_proxy[MIDBUF] = {0,}, socks_proxy[MIDBUF] = {0,},
- dns1[MIDBUF] = {0}, dns2[MIDBUF] = {0};
+ dns[MIDBUF] = {0};
tizen_base_port = get_sdb_base_port();
gethostproxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
- gethostDNS(dns1, dns2);
+ // using "DNS" provided by default QEMU
+ g_strlcpy(dns, DEFAULT_QEMU_DNS_IP, strlen(DEFAULT_QEMU_DNS_IP) + 1);
check_shdmem();
socket_init();
" http_proxy=%s https_proxy=%s ftp_proxy=%s socks_proxy=%s"
" dns1=%s", tizen_base_port,
http_proxy, https_proxy, ftp_proxy, socks_proxy,
- dns1, dns2);
+ dns);
g_strlcat(maru_kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE);
#endif
const char *pactempfile = ".autoproxy";
-/**
- @brief get host DNS server address
- @param dns1: return value (first dns server address)
- @param dns2: return value (second dns server address)
- @return always 0
- */
-int gethostDNS(char *dns1, char *dns2)
-{
-#ifndef _WIN32
- FILE *resolv;
- char buf[255];
- memset(buf, 0, sizeof(char)*255);
-
- resolv = fopen("/etc/resolv.conf", "r");
- if (resolv <= 0) {
- ERR( "Can't open \"/etc/resolv.conf.\"\n");
- fclose(resolv);
- return 1;
- }
-
- while(fscanf(resolv , "%s", buf) != EOF) {
- if(strcmp(buf, "nameserver") == 0)
- {
- if(fscanf(resolv , "%s", dns1) <= 0) {
- // do nothing...
- }
- break;
- }
- }
-
- while(fscanf(resolv , "%s", buf) != EOF) {
- if(strcmp(buf, "nameserver") == 0)
- {
- if(fscanf(resolv , "%s", dns2) <= 0) {
- // do nothing...
- }
- break;
- }
- }
-
- fclose(resolv);
-#else
- PIP_ADAPTER_ADDRESSES pAdapterAddr;
- PIP_ADAPTER_ADDRESSES pAddr;
- PIP_ADAPTER_DNS_SERVER_ADDRESS pDnsAddr;
- unsigned long nBufferLength = sizeof(IP_ADAPTER_ADDRESSES);
- pAdapterAddr = (PIP_ADAPTER_ADDRESSES)malloc(nBufferLength);
- memset(pAdapterAddr, 0x00, nBufferLength);
-
- while (GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddr, &nBufferLength)
- == ERROR_BUFFER_OVERFLOW) {
- free(pAdapterAddr);
- pAdapterAddr = (PIP_ADAPTER_ADDRESSES)malloc(nBufferLength);
- memset(pAdapterAddr, 0x00, nBufferLength);
- }
-
- pAddr = pAdapterAddr;
- for (; pAddr != NULL; pAddr = pAddr->Next) {
- pDnsAddr = pAddr->FirstDnsServerAddress;
- for (; pDnsAddr != NULL; pDnsAddr = pDnsAddr->Next) {
- struct sockaddr_in *pSockAddr = (struct sockaddr_in*)pDnsAddr->Address.lpSockaddr;
- if(*dns1 == 0) {
- strcpy(dns1, inet_ntoa(pSockAddr->sin_addr));
- continue;
- }
- if(*dns2 == 0) {
- strcpy(dns2, inet_ntoa(pSockAddr->sin_addr));
- continue;
- }
- }
- }
- free(pAdapterAddr);
-#endif
-
- // by caramis... change DNS address if localhost has DNS server or DNS cache.
- if(!strncmp(dns1, "127.0.0.1", 9) || !strncmp(dns1, "localhost", 9)) {
- strncpy(dns1, "10.0.2.2", 9);
- }
- if(!strncmp(dns2, "127.0.0.1", 9) || !strncmp(dns2, "localhost", 9)) {
- strncpy(dns2, "10.0.2.2", 9);
- }
-
- return 0;
-}
-
#if defined (CONFIG_DARWIN)
static char *cfstring_to_cstring(CFStringRef str) {
if (str == NULL) {