Changeset 15062 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 7, 2008 11:44:04 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15060 r15062 37 37 #include "slirp.h" 38 38 #include "ip_icmp.h" 39 #ifdef RT_OS_WINDOWS 40 #include <Icmpapi.h> 41 #include <Iphlpapi.h> 42 #endif 39 43 40 44 … … 72 76 pData->icmp_socket.so_type = IPPROTO_ICMP; 73 77 pData->icmp_socket.so_state = SS_ISFCONNECTED; 78 #ifndef RT_OS_WINDOWS 74 79 pData->icmp_socket.s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); 80 #else 81 pData->icmp_socket.s = IcmpCreateFile(); 82 #endif 75 83 insque(pData, &pData->icmp_socket, &udb); 76 84 LIST_INIT(&pData->icmp_msg_head); … … 236 244 } 237 245 #else /* !VBOX_WITH_SLIRP_ICMP */ 246 #ifdef RT_OS_WINDOWS 247 IP_OPTION_INFORMATION ipopt; 248 #endif 238 249 addr.sin_family = AF_INET; 239 250 if ((ip->ip_dst.s_addr & htonl(pData->netmask)) == special_addr.s_addr) { … … 253 264 icmp_attach(pData, m); 254 265 /* Send the packet */ 266 #ifndef RT_OS_WINDOWS 255 267 status = setsockopt(pData->icmp_socket.s, IPPROTO_IP, IP_TTL, (void *)&ip->ip_ttl, sizeof(ip->ip_ttl)); 256 268 if (status < 0) { … … 264 276 m_free(pData, m); 265 277 } 278 #else 279 memset(&ipopt, 0, sizeof(IP_OPTION_INFORMATION)); 280 ipopt.Ttl = ip->ip_ttl; 281 m->m_ext = malloc(1500); 282 status = IcmpSendEcho(pData->icmp_socket.s, VBOX_SOCKET_EVENT, &addr, icp, icmplen, m->m_ext, 1500, 0); 283 if (status == 0) { 284 LogRel(("error(%d) occured while sending ICMP\n", GetLastError())); 285 } 286 #endif 266 287 267 288 #endif /* VBOX_WITH_SLIRP_ICMP */
Note:
See TracChangeset
for help on using the changeset viewer.