Changeset 18225 in vbox
- Timestamp:
- Mar 24, 2009 7:56:11 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 44950
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r17656 r18225 101 101 } while (0) 102 102 # else /* !RT_OS_WINDOWS */ 103 # ifdef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC 103 # ifdef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC 104 104 # define DO_WIN_CHECK_FD_SET(so, events, fdset ) DO_CHECK_FD_SET((so), (events), fdset) 105 105 # else /* VBOX_WITH_SIMPLIFIED_SLIRP_SYNC */ … … 335 335 struct dns_entry *da = NULL; 336 336 ULONG ret = ERROR_SUCCESS; 337 337 338 338 /* @todo add SKIPing flags to get only required information */ 339 339 340 340 ret = pData->pfGetAdaptersAddresses(AF_INET, 0, NULL /* reserved */, addresses, &size); 341 if (ret != ERROR_BUFFER_OVERFLOW) 341 if (ret != ERROR_BUFFER_OVERFLOW) 342 342 { 343 343 LogRel(("NAT: error %lu occured on capacity detection operation\n", ret)); 344 344 return -1; 345 345 } 346 347 if (size == 0) 346 347 if (size == 0) 348 348 { 349 349 LogRel(("NAT: Win socket API returns non capacity\n")); 350 350 return -1; 351 351 } 352 352 353 353 addresses = RTMemAllocZ(size); 354 if (addresses == NULL) 354 if (addresses == NULL) 355 355 { 356 356 LogRel(("NAT: No memory available \n")); … … 362 362 { 363 363 LogRel(("NAT: error %lu occured on fetching adapters info\n", ret)); 364 return -1; 364 return -1; 365 365 } 366 366 addr = addresses; 367 while(addr != NULL) 367 while(addr != NULL) 368 368 { 369 369 size_t buff_size; … … 371 371 goto next; 372 372 dns = addr->FirstDnsServerAddress; 373 while (dns != NULL) 373 while (dns != NULL) 374 374 { 375 375 struct sockaddr *saddr = dns->Address.lpSockaddr; … … 386 386 if ((((struct sockaddr_in *)saddr)->sin_addr.s_addr & htonl(IN_CLASSA_NET)) == ntohl(INADDR_LOOPBACK & IN_CLASSA_NET)) { 387 387 da->de_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 388 } 389 else 388 } 389 else 390 390 { 391 391 da->de_addr.s_addr = ((struct sockaddr_in *)saddr)->sin_addr.s_addr; 392 392 } 393 393 LIST_INSERT_HEAD(&pData->dns_list_head, da, de_list); 394 next_dns: 394 next_dns: 395 395 dns = dns->Next; 396 396 } 397 397 buff_size = wcstombs(NULL, addr->DnsSuffix, 0); 398 if (buff_size == 0) 398 if (buff_size == 0) 399 399 goto next; 400 suffix = RTMemAllocZ(buff_size );400 suffix = RTMemAllocZ(buff_size + 1); 401 401 wcstombs(suffix, addr->DnsSuffix, buff_size); 402 402 LogRel(("NAT: adding %s to DNS suffix list\n", suffix)); 403 403 *ppszDomain = suffix; 404 404 next: 405 405 addr = addr->Next; 406 406 } 407 407 /*@todo add dns suffix if required */ 408 408 LogRel(("NAT: adding dns suffix %s to the list \n", ppszDomain)); 409 return 0; 409 return 0; 410 410 } 411 411 # endif /* VBOX_WITH_MULTI_DNS */ … … 871 871 #ifdef VBOX_WITH_SLIRP_DNS_PROXY 872 872 Log2(("NAT: %R[natsock] expired\n", so)); 873 if (so->so_timeout != NULL) 873 if (so->so_timeout != NULL) 874 874 { 875 875 so->so_timeout(pData, so, so->so_timeout_arg); 876 } 876 } 877 877 #endif 878 878 #ifdef VBOX_WITH_SLIRP_MT … … 1207 1207 inq = outq = 0; 1208 1208 status = getsockopt(so->s, SOL_SOCKET, SO_ERROR, &err, &optlen); 1209 if (status != 0) 1209 if (status != 0) 1210 1210 Log(("NAT: can't get error status from %R[natsock]\n", so)); 1211 1211 #ifndef RT_OS_SOLARIS … … 1217 1217 } 1218 1218 status = ioctl(so->s, TIOCOUTQ, &outq); /* SIOCOUTQ see previous comment */ 1219 if (status != 0) 1219 if (status != 0) 1220 1220 Log(("NAT: can't get depth of OUT queue from %R[natsock]\n", so)); 1221 1221 #else 1222 1222 /* 1223 1223 * Solaris has bit different ioctl commands and its handlings 1224 * hint: streamio(7) I_NREAD 1224 * hint: streamio(7) I_NREAD 1225 1225 */ 1226 1226 #endif … … 1229 1229 { 1230 1230 /** 1231 * Check if we need here take care about gracefull connection 1231 * Check if we need here take care about gracefull connection 1232 1232 * @todo try with proxy server 1233 1233 */ … … 1235 1235 { 1236 1236 /* 1237 * Never meet inq != 0 or outq != 0, anyway let it stay for a while 1238 * in case it happens we'll able to detect it. 1239 * Give TCP/IP stack wait or expire the socket. 1237 * Never meet inq != 0 or outq != 0, anyway let it stay for a while 1238 * in case it happens we'll able to detect it. 1239 * Give TCP/IP stack wait or expire the socket. 1240 1240 */ 1241 1241 Log(("NAT: %R[natsock] err(%d:%s) s(in:%d,out:%d)happens on read I/O, " … … 1247 1247 if ( !UNIX_CHECK_FD_SET(so, NetworkEvents, readfds) 1248 1248 && !UNIX_CHECK_FD_SET(so, NetworkEvents, writefds) 1249 && !UNIX_CHECK_FD_SET(so, NetworkEvents, xfds)) 1249 && !UNIX_CHECK_FD_SET(so, NetworkEvents, xfds)) 1250 1250 { 1251 1251 Log(("NAT: system expires the socket %R[natsock] err(%d:%s) s(in:%d,out:%d) happens on non-I/O. ", … … 1254 1254 } 1255 1255 Log(("NAT: %R[natsock] we've met(%d:%s) s(in:%d, out:%d) unhandled combination hup (%d) " 1256 "rederr(%d) on (r:%d, w:%d, x:%d)\n", 1256 "rederr(%d) on (r:%d, w:%d, x:%d)\n", 1257 1257 so, err, strerror(err), 1258 1258 inq, outq, … … 1262 1262 UNIX_CHECK_FD_SET(so, ign, writefds), 1263 1263 UNIX_CHECK_FD_SET(so, ign, xfds))); 1264 /* 1264 /* 1265 1265 * Give OS's TCP/IP stack a chance to resolve an issue or expire the socket. 1266 1266 */ … … 1648 1648 uint16_t hdport, hsport, service; 1649 1649 hdport = ntohs(dport); 1650 hsport = ntohs(sport); 1650 hsport = ntohs(sport); 1651 1651 Log2(("proto: %d, dport: %d sport: %d\n", proto, hdport, hsport)); 1652 1652 service = 0; 1653 1653 #if 0 1654 1654 /* Always return 0 here */ 1655 switch (hdport) 1655 switch (hdport) 1656 1656 { 1657 1657 case 500: 1658 1658 /* service = sport; */ 1659 1659 break; 1660 } 1660 } 1661 1661 #endif 1662 1662 Log2(("service : %d\n", service));
Note:
See TracChangeset
for help on using the changeset viewer.