Changeset 88525 in vbox
- Timestamp:
- Apr 15, 2021 11:40:05 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmpwin.c
r82968 r88525 46 46 TAILQ_ENTRY(pong) queue_entry; 47 47 48 struct ip reqiph; 48 union { 49 struct ip ip; 50 uint8_t au[60]; 51 } reqiph; 49 52 struct icmp_echo reqicmph; 50 53 … … 146 149 AssertReturnVoid(ttl > 0); 147 150 148 reqsize = ip->ip_len - hlen - sizeof(struct icmp_echo); 151 size_t hdrsize = hlen + sizeof(struct icmp_echo); 152 reqsize = ip->ip_len - hdrsize; 149 153 150 154 bufsize = sizeof(ICMP_ECHO_REPLY); … … 172 176 { 173 177 /* already in single contiguous buffer */ 174 reqdata = mtod(m, char *) + sizeof(struct ip) + sizeof(struct icmp_echo);178 reqdata = mtod(m, char *) + hdrsize; 175 179 } 176 180 else … … 178 182 /* use reply buffer as temporary storage */ 179 183 reqdata = pong->buf; 180 m_copydata(m, sizeof(struct ip) + sizeof(struct icmp_echo), 181 (int)reqsize, reqdata); 184 m_copydata(m, (int)hdrsize, (int)reqsize, reqdata); 182 185 } 183 186 … … 398 401 ip->ip_p = IPPROTO_ICMP; 399 402 ip->ip_src.s_addr = reply->Address; 400 ip->ip_dst = pong->reqiph.ip _src;403 ip->ip_dst = pong->reqiph.ip.ip_src; 401 404 402 405 icmp->icmp_type = ICMP_ECHOREPLY; … … 479 482 Log2(("NAT: ping error type %d/code %d\n", type, code)); 480 483 481 reqsize = sizeof(pong->reqiph) + sizeof(pong->reqicmph); 484 size_t reqhlen = pong->reqiph.ip.ip_hl << 2; 485 reqsize = reqhlen + sizeof(pong->reqicmph); 482 486 483 487 m = icmpwin_get_mbuf(pData, reqsize); … … 494 498 ip->ip_p = IPPROTO_ICMP; 495 499 ip->ip_src.s_addr = 0; /* NB */ 496 ip->ip_dst = pong->reqiph.ip _src;500 ip->ip_dst = pong->reqiph.ip.ip_src; 497 501 498 502 icmp->icmp_type = type; … … 502 506 icmp->icmp_echo_seq = 0; 503 507 504 m_append(pData, m, sizeof(pong->reqiph), (caddr_t)&pong->reqiph); 508 /* payload: the IP and ICMP headers of the original request */ 509 m_append(pData, m, (int)reqhlen, (caddr_t)&pong->reqiph); 505 510 m_append(pData, m, sizeof(pong->reqicmph), (caddr_t)&pong->reqicmph); 506 511
Note:
See TracChangeset
for help on using the changeset viewer.