Changeset 15230 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 10, 2008 8:14:42 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15222 r15230 140 140 struct icmp_msg *icm = NULL; 141 141 int found = 0; 142 struct socket *head_socket; 142 struct udphdr *udp; 143 struct tcphdr *tcp; 144 struct socket *head_socket, *so; 143 145 struct in_addr laddr, faddr; 144 146 u_int lport, fport; 147 148 laddr.s_addr = ~0; 149 faddr.s_addr = ~0; 150 151 lport = ~0; 152 fport = ~0; 153 145 154 146 155 switch (ip->ip_p) … … 163 172 } 164 173 } 174 /* 175 * for TCP and UDP logic little bit reverted, we try to find the HOST socket 176 * from which the IP package has been sent. 177 */ 165 178 case IPPROTO_UDP: 166 179 head_socket = &udb; 180 udp = (struct udphdr *)((char *)ip + (ip->ip_hl >> 2)); 181 faddr.s_addr = ip->ip_dst.s_addr; 182 fport = udp->uh_dport; 183 laddr.s_addr = ip->ip_src.s_addr; 184 lport = udp->uh_sport; 167 185 case IPPROTO_TCP: 168 head_socket = (head_socket != NULL ? head_socket : &tcb); /* head_socket could be initialized with udb*/ 186 if (head_socket == NULL) 187 { 188 tcp = (struct tcphdr *)((char *)ip + (ip->ip_hl >> 2)); 189 head_socket = &tcb; /* head_socket could be initialized with udb*/ 190 faddr.s_addr = ip->ip_dst.s_addr; 191 fport = tcp->th_dport; 192 laddr.s_addr = ip->ip_src.s_addr; 193 lport = tcp->th_sport; 194 } 195 for (so = head_socket; so != head_socket; so = so->so_next) 196 { 197 /* Should be reaplaced by hash here */ 198 if (so->so_faddr.s_addr == faddr.s_addr 199 && so->so_fport == fport 200 && so->so_hladdr.s_addr == laddr.s_addr 201 && so->so_hlport == lport) { 202 icm = malloc(sizeof(struct icmp_msg)); 203 icm->im_m = so->so_m; 204 found = 1; 205 } 206 } 207 break; 208 default: 209 LogRel(("%s:ICMP: unsupported protocol(%d)\n", __FUNCTION__, ip->ip_p)); 169 210 } 170 211 if (found == 1) -
trunk/src/VBox/Devices/Network/slirp/socket.h
r15149 r15230 45 45 u_int16_t so_fport; /* foreign port */ 46 46 u_int16_t so_lport; /* local port */ 47 #ifdef VBOX_WITH_SLIRP_ICMP 48 u_int16_t so_hlport; /* host local port */ 49 struct in_addr so_hladdr; /* local host addr */ 50 #endif 47 51 48 52 u_int8_t so_iptos; /* Type of service */
Note:
See TracChangeset
for help on using the changeset viewer.