Changeset 14684 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Nov 27, 2008 8:13:25 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r14633 r14684 70 70 icmp_attach(PNATState pData, struct socket *so) { 71 71 AssertRelease(so != NULL); 72 if (pData->icmp_socket == 0) 73 pData->icmp_socket = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); 74 AssertRelease(pData->icmp_socket != -1); 75 so->s = pData->icmp_socket; 72 so->s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); 73 insque(pData, so, &udb); /*adding it udb queue*/ 76 74 return (so->s); 77 75 } … … 187 185 errno,strerror(errno))); 188 186 icmp_error(pData, m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); 187 udp_detach(pData, so); 189 188 } 190 189 … … 385 384 386 385 ip->ip_ttl = MAXTTL; 386 #ifndef VBOX_WITH_SLIRP_ICMP 387 387 { /* swap */ 388 388 struct in_addr icmp_dst; … … 391 391 ip->ip_src = icmp_dst; 392 392 } 393 #endif 393 394 394 395 (void ) ip_output(pData, (struct socket *)NULL, m); -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r14641 r14684 129 129 struct socket udb; 130 130 struct socket *udp_last_so; 131 #ifdef VBOX_WITH_SLIRP_ICMP132 int icmp_socket;133 #endif134 131 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 135 132 # define VBOX_SOCKET_EVENT (pData->phEvents[VBOX_SOCKET_EVENT_INDEX]) -
trunk/src/VBox/Devices/Network/slirp/socket.c
r14470 r14684 412 412 icmp_error(pData, so->so_m, ICMP_UNREACH,code, 0,strerror(errno)); 413 413 } else { 414 #ifdef VBOX_WITH_SLIRP_ICMP 415 struct ip *ip; 416 uint32_t dst; 417 ip = mtod(so->so_m, struct ip *); 418 dst = ip->ip_src.s_addr; 419 memcpy(so->so_m->m_data, buff, len); /* ovveride ther tail of old packet */ 420 /* the low level expects fields to be in host format so let's convert them*/ 421 ip = mtod(so->so_m, struct ip *); 422 NTOHS(ip->ip_len); 423 NTOHS(ip->ip_off); 424 NTOHS(ip->ip_id); 425 ip->ip_dst.s_addr = dst; 426 #endif 414 427 icmp_reflect(pData, so->so_m); 415 428 so->so_m = 0; /* Don't m_free() it again! */
Note:
See TracChangeset
for help on using the changeset viewer.