Changeset 15597 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 16, 2008 4:05:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r15590 r15597 909 909 uint32_t src; 910 910 ICMP_ECHO_REPLY *icr; 911 int hlen = 0; 912 int data_len = 0; 913 int nbytes = 0; 911 914 u_char code = ~0; 915 912 916 len = pData->pfIcmpParseReplies(pData->pvIcmpBuffer, pData->szIcmpBuffer); 913 917 if (len < 0) … … 918 922 if (len == 0) 919 923 return; /* no error */ 924 920 925 icr = (ICMP_ECHO_REPLY *)pData->pvIcmpBuffer; 921 926 for (i = 0; i < len; ++i) … … 941 946 ip->ip_p = IPPROTO_ICMP; 942 947 ip->ip_dst.s_addr = so->so_laddr.s_addr; /*XXX: still the hack*/ 943 ip->ip_hl = sizeof(struct ip) >> 2; /* requiered for icmp_reflect, no IP options */ 948 data_len = sizeof(struct ip); 949 ip->ip_hl = data_len >> 2; /* requiered for icmp_reflect, no IP options */ 944 950 ip->ip_ttl = icr[i].Options.Ttl; 945 951 … … 949 955 icp->icmp_id = so->so_icmp_id; 950 956 icp->icmp_seq = so->so_icmp_seq; 951 memcpy(icp->icmp_data, icr[i].Data, icr[i].DataSize); 952 953 ip->ip_len = sizeof(struct ip) + ICMP_MINLEN + icr[i].DataSize; 957 958 data_len += ICMP_MINLEN; 959 960 nbytes = (data_len + icr[i].DataSize > m->m_size? m->m_size - data_len: icr[i].DataSize); 961 memcpy(icp->icmp_data, icr[i].Data, nbytes); 962 963 data_len += icr[i].DataSize; 964 965 ip->ip_len = data_len; 954 966 m->m_len = ip->ip_len; 955 967 … … 970 982 ip->ip_dst.s_addr = src; 971 983 ip->ip_dst.s_addr = icr[i].Address; 972 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 984 985 hlen = (ip->ip_hl << 2); 986 icp = (struct icmp *)((char *)ip + hlen); 973 987 ip_broken->ip_src.s_addr = src; /*it packet sent from host not from guest*/ 974 memcpy(icp->icmp_data, ip_broken, (ip_broken->ip_hl << 2) + 64); 988 data_len = (ip_broken->ip_hl << 2) + 64; 989 990 nbytes =(hlen + ICMP_MINLEN + data_len > m->m_size? m->m_size - (hlen + ICMP_MINLEN): data_len); 991 memcpy(icp->icmp_data, ip_broken, nbytes); 975 992 icmp_reflect(pData, m); 976 993 break;
Note:
See TracChangeset
for help on using the changeset viewer.