Changeset 15143 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 9, 2008 9:33:51 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15139 r15143 111 111 return 1; 112 112 } 113 pData->icmp_socket.s = IcmpCreateFile();113 pData->icmp_socket.sh = IcmpCreateFile(); 114 114 pData->phEvents[VBOX_ICMP_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); 115 115 pData->szIcmpBuffer = sizeof(ICMP_ECHO_REPLY) * 10; … … 331 331 memset(&ipopt, 0, sizeof(IP_OPTION_INFORMATION)); 332 332 ipopt.Ttl = ip->ip_ttl; 333 status = IcmpSendEcho2(pData->icmp_socket.s , pData->phEvents[VBOX_ICMP_EVENT_INDEX],333 status = IcmpSendEcho2(pData->icmp_socket.sh, pData->phEvents[VBOX_ICMP_EVENT_INDEX], 334 334 NULL, NULL, addr.sin_addr.s_addr, icp->icmp_data, 335 335 icmplen - offsetof(struct icmp, icmp_data) , &ipopt, -
trunk/src/VBox/Devices/Network/slirp/socket.c
r15138 r15143 844 844 int len; 845 845 int i; 846 struct ip *ip; 847 struct mbuf *m; 848 struct icmp *icp; 846 849 ICMP_ECHO_REPLY *icr; 847 850 u_char code = ~0; … … 870 873 break; 871 874 case IP_SUCCESS: /* echo replied */ 875 m = m_get(pData); 876 ip = mtod(m, struct ip *); 877 ip->ip_src.s_addr = icr[i].Address; 878 ip->ip_p = IPPROTO_ICMP; 879 ip->ip_dst.s_addr = inet_addr("10.0.0.15"); /*XXX:hack here*/ 880 ip->ip_hl = sizeof(struct ip) >> 2; 881 882 icp = (struct icmp *)&ip[1]; /* no options */ 883 icp->icmp_type = ICMP_ECHOREPLY; 884 icp->icmp_code = 0; 885 memcpy(icp->icmp_data, icr[i].Data, icr[i].DataSize); 886 887 ip->ip_len = sizeof(struct ip) + ICMP_MINLEN + icr[i].DataSize; 888 m->m_len = ip->ip_len; 889 890 icmp_reflect(pData, m); 891 m_free(pData, m); 872 892 case IP_TTL_EXPIRED_TRANSIT: /* TTL expired */ 873 __asm {int 3} 893 LogRel(("ICMP: message with Status: %x was received from %x\n", icr[i].Status, icr[i].Address)); 894 LogRel(("ICMP: IP(v %hd, l %hd )\n", ip->ip_v, ip->ip_hl)); 874 895 break; 875 896 default: 876 LogRel(("ICMP : message with Status: %x was received from %R[IP4]\n", icr[i].Status, icr[i].Address));897 LogRel(("ICMP(default): message with Status: %x was received from %s\n", icr[i].Status, icr[i].Address)); 877 898 break; 878 899 } -
trunk/src/VBox/Devices/Network/slirp/socket.h
r14964 r15143 23 23 struct socket *so_prev; /* For a linked list of sockets */ 24 24 25 #ifndef RT_OS_WINDOWS 25 26 int s; /* The actual socket */ 27 #else 28 union { 29 int s; 30 HANDLE sh; 31 }; 32 #endif 26 33 27 34 /* XXX union these with not-yet-used sbuf params */
Note:
See TracChangeset
for help on using the changeset viewer.