- Timestamp:
- Jun 22, 2010 7:15:52 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_output.c
r30016 r30352 206 206 int mhlen, firstlen = len; 207 207 struct mbuf **mnext = &m->m_nextpkt; 208 char *buf; /* intermediate buffer we'll use for copy from orriginal packet */208 char *buf; /* intermediate buffer we'll use for a copy of the original packet */ 209 209 { 210 210 struct m_tag *t; … … 218 218 if (m->m_next != NULL) 219 219 { 220 /* we've receives packet in fragments*/220 /* we've receives packet in fragments */ 221 221 tmplen = m_length(m, NULL); 222 222 tmpbuf = RTMemAlloc(tmplen); … … 228 228 tmpbuf = mtod(m, char *); 229 229 tmplen = m_length(m, NULL); 230 231 230 } 232 231 -
trunk/src/VBox/Devices/Network/slirp/udp.c
r30350 r30352 161 161 162 162 #endif 163 if (cksum(m, len + iphlen))163 if (cksum(m, len + iphlen)) 164 164 { 165 165 udpstat.udps_badsum++; 166 166 Log3(("NAT: IP(id: %hd) has bad (udp) cksum\n", ip->ip_id)); 167 goto bad ;167 goto bad_free_mbuf; 168 168 } 169 169 } … … 178 178 { 179 179 bootp_input(pData, m); 180 goto done ;180 goto done_free_mbuf; 181 181 } 182 182 … … 191 191 dst.sin_port = uh->uh_sport; 192 192 193 /* udp_output2 expects pointer on the body of UDP packet. */ 194 193 /* udp_output2() expects a pointer to the body of UDP packet. */ 195 194 m->m_data += sizeof(struct udpiphdr); 196 195 m->m_len -= sizeof(struct udpiphdr); 197 196 udp_output2(pData, NULL, m, &src, &dst, IPTOS_LOWDELAY); 198 /* we shouldn't free this mbuf*/199 197 return; 200 198 } … … 206 204 { 207 205 tftp_input(pData, m); 208 goto done ;206 goto done_free_mbuf; 209 207 } 210 208 … … 245 243 { 246 244 Log2(("NAT: IP(id: %hd) failed to create socket\n", ip->ip_id)); 247 goto bad ;245 goto bad_free_mbuf; 248 246 } 249 247 if (udp_attach(pData, so, 0) == -1) … … 252 250 ip->ip_id, errno, strerror(errno))); 253 251 sofree(pData, so); 254 goto bad ;252 goto bad_free_mbuf; 255 253 } 256 254 … … 281 279 { 282 280 dnsproxy_query(pData, so, m, iphlen); 283 goto done ;281 goto done_free_mbuf; 284 282 } 285 283 … … 314 312 *ip = save_ip; 315 313 so->so_m = m; /* ICMP backup */ 316 317 314 return; 318 315 319 bad :316 bad_free_mbuf: 320 317 Log2(("NAT: UDP(id: %hd) datagram to %R[IP4] with size(%d) claimed as bad\n", 321 318 ip->ip_id, &ip->ip_dst, ip->ip_len)); 322 done: 319 320 done_free_mbuf: 323 321 /* some services like bootp(built-in), dns(buildt-in) and dhcp don't need sockets 324 322 * and create new m'buffers to send them to guest, so we'll free their incomming … … 329 327 } 330 328 329 /** 330 * Output a UDP packet. This function will finally free the mbuf so 331 * do NOT free any passed mbuf. 332 */ 331 333 int udp_output2(PNATState pData, struct socket *so, struct mbuf *m, 332 334 struct sockaddr_in *saddr, struct sockaddr_in *daddr,
Note:
See TracChangeset
for help on using the changeset viewer.