- Timestamp:
- Jun 8, 2009 4:49:01 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/sbuf.c
r17191 r20377 39 39 40 40 void 41 sbreserve( struct sbuf *sb, int size)41 sbreserve(PNATState pData, struct sbuf *sb, int size) 42 42 { 43 43 if (sb->sb_data) … … 83 83 DEBUG_ARG("m->m_len = %d", m->m_len); 84 84 85 SLIRP_COUNTER_RESET(IOSBAppend); 86 SLIRP_COUNTER_RESET(IOSBAppend_zm); 87 SLIRP_COUNTER_RESET(IOSBAppend_wa); 88 SLIRP_COUNTER_RESET(IOSBAppend_wf); 89 SLIRP_COUNTER_RESET(IOSBAppend_wp); 90 91 SLIRP_COUNTER_INC(IOSBAppend); 85 92 /* Shouldn't happen, but... e.g. foreign host closes connection */ 86 93 if (m->m_len <= 0) 87 94 { 88 m_free(pData,m);89 return;95 SLIRP_COUNTER_INC(IOSBAppend_zm); 96 goto done; 90 97 } 91 98 … … 97 104 if (so->so_urgc) 98 105 { 99 sbappendsb( &so->so_rcv, m);106 sbappendsb(pData, &so->so_rcv, m); 100 107 m_free(pData, m); 101 108 sosendoob(so); … … 112 119 if (ret <= 0) 113 120 { 121 SLIRP_COUNTER_INC(IOSBAppend_wf); 114 122 /* 115 123 * Nothing was written … … 118 126 * it will be detected in the normal way by soread() 119 127 */ 120 sbappendsb(&so->so_rcv, m); 128 sbappendsb(pData, &so->so_rcv, m); 129 goto done; 121 130 } 122 131 else if (ret != m->m_len) 123 132 { 133 SLIRP_COUNTER_INC(IOSBAppend_wp); 124 134 /* 125 135 * Something was written, but not everything.. … … 128 138 m->m_len -= ret; 129 139 m->m_data += ret; 130 sbappendsb(&so->so_rcv, m); 140 sbappendsb(pData, &so->so_rcv, m); 141 goto done; 131 142 } /* else */ 132 143 /* Whatever happened, we free the mbuf */ 144 SLIRP_COUNTER_INC(IOSBAppend_wa); 145 done: 133 146 m_free(pData, m); 134 147 } … … 139 152 */ 140 153 void 141 sbappendsb( struct sbuf *sb, struct mbuf *m)154 sbappendsb(PNATState pData, struct sbuf *sb, struct mbuf *m) 142 155 { 143 156 int len, n, nn; … … 145 158 len = m->m_len; 146 159 160 SLIRP_COUNTER_RESET(IOSBAppendSB); 161 SLIRP_COUNTER_RESET(IOSBAppendSB_w_l_r); 162 SLIRP_COUNTER_RESET(IOSBAppendSB_w_ge_r); 163 SLIRP_COUNTER_RESET(IOSBAppendSB_w_alter); 164 165 SLIRP_COUNTER_INC(IOSBAppendSB); 147 166 if (sb->sb_wptr < sb->sb_rptr) 148 167 { 168 SLIRP_COUNTER_INC(IOSBAppendSB_w_l_r); 149 169 n = sb->sb_rptr - sb->sb_wptr; 150 170 if (n > len) … … 154 174 else 155 175 { 176 SLIRP_COUNTER_INC(IOSBAppendSB_w_ge_r); 156 177 /* Do the right edge first */ 157 178 n = sb->sb_data + sb->sb_datalen - sb->sb_wptr; … … 174 195 sb->sb_wptr += n; 175 196 if (sb->sb_wptr >= sb->sb_data + sb->sb_datalen) 197 { 198 SLIRP_COUNTER_INC(IOSBAppendSB_w_alter); 176 199 sb->sb_wptr -= sb->sb_datalen; 200 } 177 201 } 178 202 -
trunk/src/VBox/Devices/Network/slirp/sbuf.h
r20306 r20377 25 25 void sbfree (struct sbuf *); 26 26 void sbdrop (struct sbuf *, int); 27 void sbreserve ( struct sbuf *, int);27 void sbreserve (PNATState, struct sbuf *, int); 28 28 void sbappend (PNATState, struct socket *, struct mbuf *); 29 void sbappendsb ( struct sbuf *, struct mbuf *);29 void sbappendsb (PNATState, struct sbuf *, struct mbuf *); 30 30 void sbcopy (struct sbuf *, int, int, char *); 31 31 -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r19899 r20377 346 346 { 347 347 tcpstat.tcps_rcvbadsum++; 348 Log2(("checksum is invalid => drop\n"));349 348 goto drop; 350 349 } … … 359 358 { 360 359 tcpstat.tcps_rcvbadoff++; 361 Log2(("ti_off(tlen(%d)<%d<(tcphdr(%d))) is invalid =>drop\n", tlen, off, sizeof(struct tcphdr)));362 360 goto drop; 363 361 } … … 435 433 && so->so_deleted != 1) 436 434 { 437 Log2(("lock: %s:%d We found socket %R[natsock]\n", __FUNCTION__, __LINE__, so));438 435 break; /* so is locked here */ 439 436 } … … 441 438 } 442 439 if (so == &tcb) { 443 Log2(("lock: %s:%d Haven't find anything \n", __FUNCTION__, __LINE__));444 440 so = NULL; 445 441 } … … 470 466 * as if it was LISTENING, and continue... 471 467 */ 472 Log2(("so = %R[natsock]\n", so));473 468 if (so == 0) 474 469 { … … 484 479 } 485 480 SOCKET_LOCK(so); 486 sbreserve( &so->so_snd, tcp_sndspace);487 sbreserve( &so->so_rcv, tcp_rcvspace);481 sbreserve(pData, &so->so_snd, tcp_sndspace); 482 sbreserve(pData, &so->so_rcv, tcp_rcvspace); 488 483 489 484 /* tcp_last_so = so; */ /* XXX ? */ … … 509 504 if (so->so_state & SS_ISFCONNECTING) 510 505 { 511 Log2(("so_state(%x) of %R[natsock] is still connecting =>drop\n", so->so_state, so));512 506 goto drop; 513 507 } … … 520 514 if (tp->t_state == TCPS_CLOSED) 521 515 { 522 Log2(("t_state(%x) is closed =>drop\n", tp->t_state));523 516 goto drop; 524 517 } … … 724 717 { 725 718 if (tiflags & TH_RST) { 726 Log2(("RST(%x) is on listen =>drop\n", tiflags));727 719 goto drop; 728 720 } … … 731 723 if ((tiflags & TH_SYN) == 0) 732 724 { 733 Log2(("SYN(%x) is off on listen =>drop\n", tiflags));734 725 goto drop; 735 726 } … … 819 810 tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; 820 811 tcpstat.tcps_accepts++; 821 Log2(("hit trimthenstep6\n"));822 812 goto trimthenstep6; 823 813 } /* case TCPS_LISTEN */ … … 845 835 if (tiflags & TH_ACK) 846 836 tp = tcp_drop(pData, tp, 0); /* XXX Check t_softerror! */ 847 Log2(("RST(%x) is on SYN_SENT =>drop\n", tiflags));848 837 goto drop; 849 838 } … … 851 840 if ((tiflags & TH_SYN) == 0) 852 841 { 853 Log2(("SYN(%x) bit is off on SYN_SENT =>drop\n", tiflags));854 842 goto drop; 855 843 } … … 1103 1091 /* so->so_error = ECONNRESET; */ 1104 1092 close: 1105 Log2(("closing...=>drop\n", tp->t_state));1106 1093 tp->t_state = TCPS_CLOSED; 1107 1094 tcpstat.tcps_drops++; … … 1112 1099 case TCPS_LAST_ACK: 1113 1100 case TCPS_TIME_WAIT: 1114 Log2(("t_state is (%x) sort of close =>drop\n", tp->t_state));1115 1101 tp = tcp_close(pData, tp); 1116 1102 goto drop; … … 1132 1118 if ((tiflags & TH_ACK) == 0) 1133 1119 { 1134 Log2(("ACK(%x) bit is off =>drop\n", tiflags));1135 1120 goto drop; 1136 1121 } … … 1174 1159 tp->snd_wl1 = ti->ti_seq - 1; 1175 1160 /* Avoid ack processing; snd_una==ti_ack => dup ack */ 1176 Log2(("hit synrx_to_est\n"));1177 1161 goto synrx_to_est; 1178 1162 /* fall into ... */ … … 1243 1227 if (SEQ_GT(onxt, tp->snd_nxt)) 1244 1228 tp->snd_nxt = onxt; 1245 Log2(("t_dupacks(%d) == tcprexmtthresh(%d)=>drop\n", tp->t_dupacks, tcprexmtthresh));1246 1229 goto drop; 1247 1230 } … … 1250 1233 tp->snd_cwnd += tp->t_maxseg; 1251 1234 (void) tcp_output(pData, tp); 1252 Log2(("t_dupacks(%d) > tcprexmtthresh(%d)=>drop\n", tp->t_dupacks, tcprexmtthresh));1253 1235 goto drop; 1254 1236 } … … 1259 1241 } 1260 1242 synrx_to_est: 1261 Log2(("enter synrx_to_est\n"));1262 1243 /* 1263 1244 * If the congestion window was inflated to account … … 1397 1378 if (ourfinisacked) 1398 1379 { 1399 Log2(("ourfinisacked=>drop\n"));1400 1380 tp = tcp_close(pData, tp); 1401 1381 goto drop; … … 1488 1468 tp->rcv_up = tp->rcv_nxt; 1489 1469 dodata: 1490 Log2(("do data hit!\n"));1491 1470 1492 1471 /* … … 1898 1877 tp->snd_cwnd = mss; 1899 1878 1900 sbreserve( &so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));1901 sbreserve( &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));1879 sbreserve(pData, &so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0)); 1880 sbreserve(pData, &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0)); 1902 1881 1903 1882 DEBUG_MISC((dfd, " returning mss = %d\n", mss));
Note:
See TracChangeset
for help on using the changeset viewer.