儲存庫 vbox 的更動 15061
- 時間撮記:
- 2008-12-7 上午06:51:46 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r15035 r15061 452 452 struct icmp *icp; 453 453 int old_ip_len; 454 struct mbuf * orig_m;454 struct mbuf *m; 455 455 struct icmp_msg *icm; 456 456 457 457 ip = (struct ip *)buff; 458 458 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 459 Assert(icp->icmp_type != ICMP_ECHO); 460 if (icp->icmp_type >= ICMP_UNREACH ) { 459 460 Assert(icp->icmp_type == ICMP_ECHOREPLY || icp->icmp_type == ICMP_TIMXCEED); 461 462 if (icp->icmp_type == ICMP_TIMXCEED ) { 461 463 ip = &icp->icmp_ip; 462 464 } 465 463 466 icm = icmp_find_original_mbuf(pData, ip); 467 464 468 if (icm == NULL) { 465 469 LogRel(("Can't find the corresponding packet for the received ICMP\n")); 466 470 return; 467 471 } 468 orig_m = icm->im_m; 469 Assert(orig_m != NULL);470 471 LogRel(("ICMP message arrived on socket %d\n", so->s)); 472 473 m = icm->im_m; 474 Assert(m != NULL); 475 472 476 src = addr.sin_addr.s_addr; 473 477 474 ip = mtod(orig_m, struct ip *); /* Now ip is old header */ 475 old_ip_len = (ip->ip_hl << 2) + 64; 476 memcpy(ip_copy, ip, old_ip_len); 477 478 dst = ip->ip_src.s_addr; /* source address from original IP packet*/ 479 480 memcpy(orig_m->m_data, buff, len); /* overide ther tail of old packet */ 481 orig_m->m_len = len; 482 ip = mtod(orig_m, struct ip *); /* ip is from mbuf we've overrided */ 478 ip = mtod(m, struct ip *); 479 /* Now ip is pointing on header we've sent from guest */ 480 if (icp->icmp_type == ICMP_TIMXCEED) { 481 old_ip_len = (ip->ip_hl << 2) + 64; 482 memcpy(ip_copy, ip, old_ip_len); 483 } 484 485 /* source address from original IP packet*/ 486 dst = ip->ip_src.s_addr; 487 488 /* overide ther tail of old packet */ 489 memcpy(m->m_data, buff, len); 490 m->m_len = len; 491 ip = mtod(m, struct ip *); /* ip is from mbuf we've overrided */ 483 492 484 493 icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2)); 485 NTOHS(ip->ip_len);486 if (icp->icmp_type >= ICMP_UNREACH && icp->icmp_type != ICMP_ECHO) {487 memcpy(&icp->icmp_ip, ip_copy, old_ip_len); /* according RFC 793 error messages required copy of initial IP header + 64 bit */494 if (icp->icmp_type == ICMP_TIMXCEED) { 495 /* according RFC 793 error messages required copy of initial IP header + 64 bit */ 496 memcpy(&icp->icmp_ip, ip_copy, old_ip_len); 488 497 ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */ 489 498 } 499 490 500 /* the low level expects fields to be in host format so let's convert them*/ 501 NTOHS(ip->ip_len); 491 502 NTOHS(ip->ip_off); 492 503 NTOHS(ip->ip_id); 493 504 ip->ip_src.s_addr = src; 494 505 ip->ip_dst.s_addr = dst; 495 icmp_reflect(pData, orig_m);506 icmp_reflect(pData, m); 496 507 LIST_REMOVE(icm, im_list); 497 508 /* Don't call m_free here*/
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器