Changeset 15435 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Dec 13, 2008 11:55:20 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r15396 r15435 792 792 struct icmp *icp; 793 793 int old_ip_len; 794 int hlen, original_hlen; 794 795 struct mbuf *m; 795 796 struct icmp_msg *icm; … … 797 798 798 799 ip = (struct ip *)buff; 799 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 800 hlen = (ip->ip_hl << 2); 801 icp = (struct icmp *)((char *)ip + hlen); 800 802 801 803 LogRel(("ICMP:received msg(t:%d, c:%d)\n", icp->icmp_type, icp->icmp_code)); … … 834 836 835 837 /* overide ther tail of old packet */ 836 memcpy(m->m_data, buff, len);837 m->m_len = len;838 838 ip = mtod(m, struct ip *); /* ip is from mbuf we've overrided */ 839 original_hlen = ip->ip_hl << 2; 840 /* saves original ip header and options */ 841 memcpy(m->m_data + original_hlen, buff + hlen, len - hlen); 842 m->m_len = len - hlen + original_hlen; 839 843 840 844 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); … … 847 851 848 852 /* the low level expects fields to be in host format so let's convert them*/ 849 #ifndef RT_OS_DARWIN 850 /* Darwin returns this fields in host byte order */ 853 #if 0 /* need check on linux */ 851 854 NTOHS(ip->ip_len); 852 855 NTOHS(ip->ip_off); 853 #endif854 856 NTOHS(ip->ip_id); 857 #endif 855 858 ip->ip_src.s_addr = src; 856 859 ip->ip_dst.s_addr = dst;
Note:
See TracChangeset
for help on using the changeset viewer.