Changeset 15104 in vbox
- Timestamp:
- Dec 8, 2008 12:15:26 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15093 r15104 78 78 #ifndef RT_OS_WINDOWS 79 79 pData->icmp_socket.s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); 80 insque(pData, &pData->icmp_socket, &udb); 80 81 #else 81 82 pData->icmp_socket.s = IcmpCreateFile(); 82 83 pData->phEvents[VBOX_ICMP_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); 84 pData->szIcmpBuffer = sizeof(ICMP_ECHO_REPLY) * 10; 85 pData->pvIcmpBuffer = malloc(pData->szIcmpBuffer); 83 86 #endif 84 insque(pData, &pData->icmp_socket, &udb);85 87 LIST_INIT(&pData->icmp_msg_head); 86 88 return (0); … … 247 249 #ifdef RT_OS_WINDOWS 248 250 IP_OPTION_INFORMATION ipopt; 251 int error; 249 252 #endif 250 253 addr.sin_family = AF_INET; … … 280 283 memset(&ipopt, 0, sizeof(IP_OPTION_INFORMATION)); 281 284 ipopt.Ttl = ip->ip_ttl; 282 status = IcmpSendEcho2(pData->icmp_socket.s, pData->phEvents[VBOX_ICMP_EVENT_INDEX], NULL, NULL, &addr, icp, icmplen, &ipopt, pData->pvIcmpBuffer, pData->szIcmpBuffer, 0); 283 if (status == 0) { 284 LogRel(("error(%d) occured while sending ICMP\n", GetLastError())); 285 status = IcmpSendEcho2(pData->icmp_socket.s, pData->phEvents[VBOX_ICMP_EVENT_INDEX], NULL, NULL, addr.sin_addr.s_addr, icp, icmplen, &ipopt, 286 pData->pvIcmpBuffer, pData->szIcmpBuffer, 1000); 287 if (status == 0 && (error = GetLastError()) != ERROR_IO_PENDING) { 288 error = GetLastError(); 289 LogRel(("error(%d) occured while sending ICMP\n", GetLastError())); 290 switch(error) { 291 case ERROR_INVALID_PARAMETER: 292 LogRel(("icmp_socket:%lx is invalid\n", pData->icmp_socket.s)); 293 break; 294 case ERROR_NOT_SUPPORTED: 295 LogRel(("operation is unsupported \n")); 296 break; 297 case ERROR_NOT_ENOUGH_MEMORY: 298 LogRel(("OOM!!!\n")); 299 break; 300 case IP_BUF_TOO_SMALL: 301 LogRel(("Buffer too small\n")); 302 break; 303 default: 304 LogRel(("Other error!!!\n")); 305 break; 306 } 285 307 } 286 308 #endif -
trunk/src/VBox/Devices/Network/slirp/socket.c
r15093 r15104 848 848 return; 849 849 } 850 LogRel(("IcmpParseReplies returns %ld\n", len)); 850 851 icr = (ICMP_ECHO_REPLY *)pData->pvIcmpBuffer; 851 852 for (i = 0; i < len; ++i) { … … 862 863 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, "Error occured!!!"); 863 864 break; 865 case IP_SUCCESS: /* echo replied */ 866 case IP_TTL_EXPIRED_TRANSIT: /* TTL expired */ 867 __asm {int 3} 868 break; 869 default: 870 LogRel(("ICMP: message with Status: %x was received from %R[IP4]\n", icr[i].Status, icr[i].Address)); 871 break; 864 872 } 865 873 }
Note:
See TracChangeset
for help on using the changeset viewer.