Changeset 17191 in vbox
- Timestamp:
- Feb 27, 2009 8:43:04 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip.h
r15453 r17191 222 222 #define IPREASS_HASH(x,y) \ 223 223 (((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK) 224 TAILQ_HEAD(ipqhead, ipq_t);224 TAILQ_HEAD(ipqhead, ipq_t); 225 225 226 226 /* -
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r17151 r17191 395 395 Log((dfd,"icmp_input udp sendto tx errno = %d-%s\n", 396 396 errno, strerror(errno))); 397 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));397 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); 398 398 } 399 399 } -
trunk/src/VBox/Devices/Network/slirp/ip_input.c
r15845 r17191 107 107 * if (ip->ip_sum) { 108 108 */ 109 if (cksum(m,hlen))109 if (cksum(m, hlen)) 110 110 { 111 111 ipstat.ips_badsum++; … … 143 143 if (ip->ip_ttl==0 || ip->ip_ttl == 1) 144 144 { 145 icmp_error(pData, m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0,"ttl");145 icmp_error(pData, m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, "ttl"); 146 146 goto bad; 147 147 } -
trunk/src/VBox/Devices/Network/slirp/sbuf.c
r15791 r17191 166 166 if (nn > len) 167 167 nn = len; 168 memcpy(sb->sb_data, m->m_data+n,nn);168 memcpy(sb->sb_data, m->m_data+n, nn); 169 169 n += nn; 170 170 } … … 195 195 if (len > sb->sb_cc) 196 196 len = sb->sb_cc; 197 memcpy(to, from,len);197 memcpy(to, from, len); 198 198 } 199 199 else … … 203 203 if (off > len) 204 204 off = len; 205 memcpy(to, from,off);205 memcpy(to, from, off); 206 206 len -= off; 207 207 if (len) 208 memcpy(to+off, sb->sb_data,len);209 } 210 } 211 208 memcpy(to+off, sb->sb_data, len); 209 } 210 } 211 -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r17056 r17191 477 477 { 478 478 WSADATA Data; 479 WSAStartup(MAKEWORD(2, 0), &Data);479 WSAStartup(MAKEWORD(2, 0), &Data); 480 480 } 481 481 # if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) … … 1322 1322 if ((htip & pData->netmask) == ntohl(special_addr.s_addr)) 1323 1323 { 1324 if ( CTL_CHECK(htip, CTL_DNS)1324 if ( CTL_CHECK(htip, CTL_DNS) 1325 1325 || CTL_CHECK(htip, CTL_ALIAS) 1326 1326 || CTL_CHECK(htip, CTL_TFTP)) -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r17056 r17191 327 327 328 328 #ifndef RT_OS_WINDOWS 329 # define min(x, y) ((x) < (y) ? (x) : (y))330 # define max(x, y) ((x) > (y) ? (x) : (y))329 # define min(x, y) ((x) < (y) ? (x) : (y)) 330 # define max(x, y) ((x) > (y) ? (x) : (y)) 331 331 #endif 332 332 -
trunk/src/VBox/Devices/Network/slirp/socket.c
r17145 r17191 194 194 DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn)); 195 195 #else 196 nn = recv(so->s, iov[0].iov_base, iov[0].iov_len, 0);196 nn = recv(so->s, iov[0].iov_base, iov[0].iov_len, 0); 197 197 #endif 198 198 if (nn <= 0) … … 226 226 /* nn == 0 means peer has performed an orderly shutdown */ 227 227 DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", 228 nn, errno, strerror(errno)));228 nn, errno, strerror(errno))); 229 229 sofcantrcvmore(so); 230 230 tcp_sockclosed(pData, sototcpcb(so)); … … 247 247 { 248 248 int ret; 249 ret = recv(so->s, iov[1].iov_base, iov[1].iov_len, 0);249 ret = recv(so->s, iov[1].iov_base, iov[1].iov_len, 0); 250 250 if (ret > 0) 251 251 nn += ret; … … 367 367 sowrite(PNATState pData, struct socket *so) 368 368 { 369 int n,nn;369 int n, nn; 370 370 struct sbuf *sb = &so->so_rcv; 371 371 size_t len = sb->sb_cc; … … 450 450 { 451 451 int ret; 452 ret = send(so->s, iov[1].iov_base, iov[1].iov_len, 0);452 ret = send(so->s, iov[1].iov_base, iov[1].iov_len, 0); 453 453 if (ret > 0) 454 454 nn += ret; … … 538 538 (struct sockaddr *)&addr, &addrlen); 539 539 Log2((" did recvfrom %d, errno = %d-%s\n", 540 m->m_len, errno, strerror(errno)));540 m->m_len, errno, strerror(errno))); 541 541 if(m->m_len < 0) 542 542 { … … 549 549 550 550 Log2((dfd," rx error, tx icmp ICMP_UNREACH:%i\n", code)); 551 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0,strerror(errno));551 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); 552 552 so->so_m = NULL; 553 553 m_free(pData, m); … … 720 720 addr.sin_port = port; 721 721 722 if ( ((s = socket(AF_INET, SOCK_STREAM,0)) < 0)723 || (setsockopt(s, SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0)722 if ( ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) 723 || (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,(char *)&opt, sizeof(int)) < 0) 724 724 || (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) 725 || (listen(s, 1) < 0))725 || (listen(s, 1) < 0)) 726 726 { 727 727 #ifdef RT_OS_WINDOWS … … 744 744 return NULL; 745 745 } 746 setsockopt(s, SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));746 setsockopt(s, SOL_SOCKET, SO_OOBINLINE,(char *)&opt, sizeof(int)); 747 747 748 748 getsockname(s,(struct sockaddr *)&addr,&addrlen); … … 808 808 if ((so->so_state & SS_NOFDREF) == 0) 809 809 { 810 shutdown(so->s, 0);810 shutdown(so->s, 0); 811 811 } 812 812 so->so_state &= ~(SS_ISFCONNECTING); … … 861 861 { 862 862 struct ip *ip; 863 uint32_t dst, src;863 uint32_t dst, src; 864 864 char ip_copy[256]; 865 865 struct icmp *icp; … … 1097 1097 1098 1098 DEBUG_MISC((dfd," udp icmp rx errno = %d-%s\n", 1099 errno, strerror(errno)));1100 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0,strerror(errno));1099 errno, strerror(errno))); 1100 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); 1101 1101 so->so_m = NULL; 1102 1102 } -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r17145 r17191 50 50 51 51 /* for modulo comparisons of timestamps */ 52 #define TSTMP_LT(a, b) ((int)((a)-(b)) < 0)53 #define TSTMP_GEQ(a, b) ((int)((a)-(b)) >= 0)52 #define TSTMP_LT(a, b) ((int)((a)-(b)) < 0) 53 #define TSTMP_GEQ(a, b) ((int)((a)-(b)) >= 0) 54 54 55 55 #ifndef TCP_ACK_HACK … … 657 657 if (so->so_emu) 658 658 { 659 if (tcp_emu(pData, so,m)) sbappend(pData, so, m); 659 if (tcp_emu(pData, so, m)) 660 sbappend(pData, so, m); 660 661 } 661 662 else … … 743 744 u_char code = ICMP_UNREACH_NET; 744 745 DEBUG_MISC((dfd," tcp fconnect errno = %d-%s\n", 745 errno, strerror(errno)));746 errno, strerror(errno))); 746 747 if (errno == ECONNREFUSED) 747 748 { … … 761 762 m->m_len += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); 762 763 *ip = save_ip; 763 icmp_error(pData, m, ICMP_UNREACH, code, 0,strerror(errno));764 icmp_error(pData, m, ICMP_UNREACH, code, 0, strerror(errno)); 764 765 tp->t_socket->so_m = NULL; 765 766 } … … 835 836 { 836 837 if (tiflags & TH_ACK) 837 tp = tcp_drop(pData, tp, 0); /* XXX Check t_softerror! */838 tp = tcp_drop(pData, tp, 0); /* XXX Check t_softerror! */ 838 839 Log2(("RST(%x) is on SYN_SENT =>drop\n", tiflags)); 839 840 goto drop; … … 1114 1115 if (tiflags & TH_SYN) 1115 1116 { 1116 tp = tcp_drop(pData, tp, 0);1117 tp = tcp_drop(pData, tp, 0); 1117 1118 goto dropwithreset; 1118 1119 } … … 1283 1284 #endif 1284 1285 if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) 1285 tcp_xmit_timer(pData, tp, tp->t_rtt);1286 tcp_xmit_timer(pData, tp, tp->t_rtt); 1286 1287 1287 1288 /* … … 1521 1522 if (so->so_emu) 1522 1523 { 1523 if (tcp_emu(pData, so, m))1524 if (tcp_emu(pData, so, m)) 1524 1525 sbappend(pData, so, m); 1525 1526 } -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r16938 r17191 377 377 DEBUG_ARG("so = %lx", (long )so); 378 378 379 if ((ret = so->s = socket(AF_INET, SOCK_STREAM,0)) >= 0)379 if ((ret = so->s = socket(AF_INET, SOCK_STREAM, 0)) >= 0) 380 380 { 381 381 int opt, s = so->s; -
trunk/src/VBox/Devices/Network/slirp/tcp_timer.c
r16443 r17191 51 51 so = tcb.so_next; 52 52 if (so) 53 QSOCKET_FOREACH (so, so_next, tcp)53 QSOCKET_FOREACH (so, so_next, tcp) 54 54 /* { */ 55 55 if ( (tp = (struct tcpcb *)so->so_tcpcb) … … 95 95 if (tp->t_timer[i] && --tp->t_timer[i] == 0) 96 96 { 97 tcp_timers(pData, tp, i);97 tcp_timers(pData, tp, i); 98 98 if (ipnxt->so_prev != ip) 99 99 goto tpgone; -
trunk/src/VBox/Devices/Network/slirp/udp.c
r17145 r17191 205 205 { 206 206 DEBUG_MISC((dfd," udp_attach errno = %d-%s\n", 207 errno, strerror(errno)));207 errno, strerror(errno))); 208 208 sofree(pData, so); 209 209 goto bad; … … 251 251 *ip = save_ip; 252 252 DEBUG_MISC((dfd,"udp tx errno = %d-%s\n", errno, strerror(errno))); 253 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));253 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); 254 254 /* in case we receive ICMP on this socket we'll aware that ICMP has been already sent to host*/ 255 255 so->so_m = NULL; … … 358 358 int status; 359 359 360 if ((so->s = socket(AF_INET, SOCK_DGRAM,0)) != -1)360 if ((so->s = socket(AF_INET, SOCK_DGRAM, 0)) != -1) 361 361 { 362 362 /* … … 709 709 return NULL; 710 710 711 so->s = socket(AF_INET, SOCK_DGRAM,0);711 so->s = socket(AF_INET, SOCK_DGRAM, 0); 712 712 if (so->s == -1) 713 713 { … … 733 733 return NULL; 734 734 } 735 setsockopt(so->s, SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));736 /* setsockopt(so->s, SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); */735 setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR,(char *)&opt, sizeof(int)); 736 /* setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE,(char *)&opt, sizeof(int)); */ 737 737 738 738 getsockname(so->s,(struct sockaddr *)&addr,&addrlen);
Note:
See TracChangeset
for help on using the changeset viewer.