Changeset 15232 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 10, 2008 8:17:39 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r15207 r15232 13 13 #include <sys/filio.h> 14 14 #endif 15 #if defined(VBOX_WITH_SLIRP_ICMP) && defined (RT_OS_WINDOWS) 15 #if defined(VBOX_WITH_SLIRP_ICMP) && defined (RT_OS_WINDOWS) 16 16 #include <iphlpapi.h> 17 17 #include <icmpapi.h> … … 439 439 { 440 440 /* This is a "ping" reply */ 441 #if !defined(VBOX_WITH_SLIRP_ICMP) || (defined(VBOX_WITH_SLIRP_ICMP) && !defined(RT_OS_WINDOWS)) 441 #if !defined(VBOX_WITH_SLIRP_ICMP) || (defined(VBOX_WITH_SLIRP_ICMP) && !defined(RT_OS_WINDOWS)) 442 442 sorecvfrom_icmp_unix(pData, so); 443 443 #endif … … 780 780 781 781 #ifdef VBOX_WITH_SLIRP_ICMP 782 static void 782 static void 783 783 send_icmp_to_guest(PNATState pData, char *buff, size_t len, struct socket *so, const struct sockaddr_in *addr) 784 784 { … … 794 794 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 795 795 796 Assert(icp->icmp_type == ICMP_ECHOREPLY || icp->icmp_type == ICMP_TIMXCEED); 796 if (icp->icmp_type != ICMP_ECHOREPLY && icp->icmp_type != ICMP_TIMXCEED) 797 { 798 LogRel(("received ICMP(t:%d, c:%d)\n", icp->icmp_type, icp->icmp_code)); 799 return; 800 } 797 801 798 802 if (icp->icmp_type == ICMP_TIMXCEED) … … 849 853 850 854 # ifdef RT_OS_WINDOWS 851 static void 855 static void 852 856 sorecvfrom_icmp_win(PNATState pData, struct socket *so) 853 857 { … … 872 876 for (i = 0; i < len; ++i) 873 877 { 874 switch(icr[i].Status) 878 switch(icr[i].Status) 875 879 { 876 880 case IP_DEST_HOST_UNREACHABLE: … … 892 896 ip->ip_dst.s_addr = so->so_laddr.s_addr; /*XXX: still the hack*/ 893 897 ip->ip_hl = sizeof(struct ip) >> 2; /* requiered for icmp_reflect, no IP options */ 894 ip->ip_ttl = icr[i].Options.Ttl; 898 ip->ip_ttl = icr[i].Options.Ttl; 895 899 896 900 icp = (struct icmp *)&ip[1]; /* no options */ … … 901 905 memcpy(icp->icmp_data, icr[i].Data, icr[i].DataSize); 902 906 903 ip->ip_len = sizeof(struct ip) + ICMP_MINLEN + icr[i].DataSize; 907 ip->ip_len = sizeof(struct ip) + ICMP_MINLEN + icr[i].DataSize; 904 908 m->m_len = ip->ip_len; 905 909 … … 908 912 909 913 ip_broken = icr[i].Data; 910 icm = icmp_find_original_mbuf(pData, ip_broken); 914 icm = icmp_find_original_mbuf(pData, ip_broken); 911 915 if (icm == NULL) { 912 916 LogRel(("ICMP: can't find original package (first double word %x)\n", *(uint32_t *)ip_broken)); … … 918 922 src = ip->ip_src.s_addr; 919 923 ip->ip_dst.s_addr = src; 920 ip->ip_dst.s_addr = icr[i].Address; 924 ip->ip_dst.s_addr = icr[i].Address; 921 925 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 922 926 ip_broken->ip_src.s_addr = src; /*it packet sent from host not from guest*/
Note:
See TracChangeset
for help on using the changeset viewer.