Changeset 15471 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Dec 14, 2008 8:50:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15457 r15471 393 393 { 394 394 /* It's an alias */ 395 switch (ntohl(ip->ip_dst.s_addr) & ~pData->netmask)395 switch (ntohl(ip->ip_dst.s_addr) & ~pData->netmask) 396 396 { 397 397 case CTL_DNS: … … 406 406 else 407 407 addr.sin_addr.s_addr = ip->ip_dst.s_addr; 408 # ifndef RT_OS_WINDOWS 409 if (pData->icmp_socket.s != -1) 410 { 411 icmp_attach(pData, m); 412 ttl = ip->ip_ttl; 413 LogRel(("NAT/ICMP: try to set TTL(%d)\n", ttl)); 414 status = setsockopt(pData->icmp_socket.s, IPPROTO_IP, IP_TTL, 415 (void *)&ttl, sizeof(ttl)); 416 if (status < 0) 417 LogRel(("NAT: Error (%s) occurred while setting TTL attribute of IP packet\n", 418 strerror(errno))); 419 if (sendto(pData->icmp_socket.s, icp, icmplen, 0, 420 (struct sockaddr *)&addr, sizeof(addr)) == -1) 421 { 422 DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n", 423 errno, strerror(errno))); 424 icmp_error(pData, m, ICMP_UNREACH,ICMP_UNREACH_NET, 0, strerror(errno)); 425 m_free(pData, m); 426 } 427 } 428 # else /* RT_OS_WINDOWS */ 408 429 icmp_attach(pData, m); 409 /* Send the packet */410 # ifndef RT_OS_WINDOWS411 ttl = ip->ip_ttl;412 LogRel(("NAT/ICMP: try to set TTL(%d)\n", ttl));413 status = setsockopt(pData->icmp_socket.s, IPPROTO_IP, IP_TTL, (void *)&ttl, sizeof(ttl));414 if (status < 0)415 {416 LogRel(("NAT: Error (%s) occurred while setting TTL attribute of IP packet\n", strerror(errno)));417 }418 if (sendto(pData->icmp_socket.s, icp, icmplen, 0,419 (struct sockaddr *)&addr, sizeof(addr)) == -1)420 {421 DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n",422 errno,strerror(errno)));423 icmp_error(pData, m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));424 m_free(pData, m);425 }426 # else /* RT_OS_WINDOWS */427 430 pData->icmp_socket.so_laddr.s_addr = ip->ip_src.s_addr; /* XXX: hack*/ 428 431 pData->icmp_socket.so_icmp_id = icp->icmp_id;
Note:
See TracChangeset
for help on using the changeset viewer.