Changeset 37728 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jul 1, 2011 12:09:55 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r35923 r37728 99 99 int flags; 100 100 STAM_PROFILE_START(&pData->StatTCP_reassamble, tcp_reassamble); 101 LogFlowFuncEnter(); 102 LogFlowFunc(("pData:%p, tp:%p, th:%p, tlenp:%p, m:%p\n", pData, tp, th, tlenp, m)); 101 103 102 104 /* … … 111 113 */ 112 114 if (th == NULL) 115 { 116 LogFlowFunc(("%d -> present\n", __LINE__)); 113 117 goto present; 118 } 114 119 115 120 /* … … 129 134 *tlenp = 0; 130 135 STAM_PROFILE_STOP(&pData->StatTCP_reassamble, tcp_reassamble); 136 LogFlowFuncLeave(); 131 137 return (0); 132 138 } … … 143 149 *tlenp = 0; 144 150 STAM_PROFILE_STOP(&pData->StatTCP_reassamble, tcp_reassamble); 151 LogFlowFuncLeave(); 145 152 return (0); 146 153 } … … 184 191 * completes. 185 192 */ 193 LogFlowFunc(("%d -> present\n", __LINE__)); 186 194 goto present; /* ??? */ 187 195 } … … 326 334 tcp_close(pData, tp); 327 335 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 336 LogFlowFuncLeave(); 328 337 return; 329 338 } … … 332 341 tiflags = ti->ti_flags; 333 342 343 LogFlowFunc(("%d -> cont_conn\n", __LINE__)); 334 344 goto cont_conn; 335 345 } … … 375 385 { 376 386 tcpstat.tcps_rcvbadsum++; 387 LogFlowFunc(("%d -> drop\n", __LINE__)); 377 388 goto drop; 378 389 } … … 387 398 { 388 399 tcpstat.tcps_rcvbadoff++; 400 LogFlowFunc(("%d -> drop\n", __LINE__)); 389 401 goto drop; 390 402 } … … 437 449 */ 438 450 findso: 451 LogFlowFunc(("findso: %R[natsock]\n", so)); 439 452 if (so != NULL && so != &tcb) 440 453 SOCKET_UNLOCK(so); … … 500 513 { 501 514 if ((tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) != TH_SYN) 515 { 516 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 502 517 goto dropwithreset; 518 } 503 519 504 520 if ((so = socreate()) == NULL) 521 { 522 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 505 523 goto dropwithreset; 524 } 506 525 if (tcp_attach(pData, so) < 0) 507 526 { 508 527 RTMemFree(so); /* Not sofree (if it failed, it's not insqued) */ 528 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 509 529 goto dropwithreset; 510 530 } … … 539 559 if (so->so_state & SS_ISFCONNECTING) 540 560 { 561 LogFlowFunc(("%d -> drop\n", __LINE__)); 541 562 goto drop; 542 563 } … … 546 567 /* XXX Should never fail */ 547 568 if (tp == 0) 569 { 570 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 548 571 goto dropwithreset; 572 } 549 573 if (tp->t_state == TCPS_CLOSED) 550 574 { 575 LogFlowFunc(("%d -> drop\n", __LINE__)); 551 576 goto drop; 552 577 } … … 756 781 { 757 782 if (tiflags & TH_RST) 783 { 784 LogFlowFunc(("%d -> drop\n", __LINE__)); 758 785 goto drop; 786 } 759 787 if (tiflags & TH_ACK) 788 { 789 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 760 790 goto dropwithreset; 791 } 761 792 if ((tiflags & TH_SYN) == 0) 793 { 794 LogFlowFunc(("%d -> drop\n", __LINE__)); 762 795 goto drop; 796 } 763 797 764 798 /* … … 809 843 SOCKET_UNLOCK(so); 810 844 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 845 LogFlowFuncLeave(); 811 846 return; 812 847 … … 815 850 * Check if the connect succeeded 816 851 */ 852 LogFlowFunc(("cont_conn:\n")); 817 853 if (so->so_state & SS_NOFDREF) 818 854 { 819 855 tp = tcp_close(pData, tp); 856 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 820 857 goto dropwithreset; 821 858 } 822 859 cont_input: 860 LogFlowFunc(("cont_input:\n")); 823 861 tcp_template(tp); 824 862 … … 838 876 tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; 839 877 tcpstat.tcps_accepts++; 878 LogFlowFunc(("%d -> trimthenstep6\n", __LINE__)); 840 879 goto trimthenstep6; 841 880 } /* case TCPS_LISTEN */ … … 857 896 && ( SEQ_LEQ(ti->ti_ack, tp->iss) 858 897 || SEQ_GT(ti->ti_ack, tp->snd_max))) 898 { 899 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 859 900 goto dropwithreset; 901 } 860 902 861 903 if (tiflags & TH_RST) … … 863 905 if (tiflags & TH_ACK) 864 906 tp = tcp_drop(pData, tp, 0); /* XXX Check t_softerror! */ 907 LogFlowFunc(("%d -> drop\n", __LINE__)); 865 908 goto drop; 866 909 } … … 868 911 if ((tiflags & TH_SYN) == 0) 869 912 { 913 LogFlowFunc(("%d -> drop\n", __LINE__)); 870 914 goto drop; 871 915 } … … 908 952 909 953 trimthenstep6: 954 LogFlowFunc(("trimthenstep6:\n")); 910 955 /* 911 956 * Advance ti->ti_seq to correspond to first data byte. … … 925 970 tp->snd_wl1 = ti->ti_seq - 1; 926 971 tp->rcv_up = ti->ti_seq; 927 Log 2(("hit6\n"));972 LogFlowFunc(("%d -> step6\n", __LINE__)); 928 973 goto step6; 929 974 } /* switch tp->t_state */ … … 1031 1076 tp = tcp_close(pData, tp); 1032 1077 tcpstat.tcps_rcvafterclose++; 1078 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 1033 1079 goto dropwithreset; 1034 1080 } … … 1058 1104 tp = tcp_close(pData, tp); 1059 1105 SOCKET_UNLOCK(tp->t_socket); 1106 LogFlowFunc(("%d -> findso\n", __LINE__)); 1060 1107 goto findso; 1061 1108 } … … 1073 1120 } 1074 1121 else 1122 { 1123 LogFlowFunc(("%d -> dropafterack\n", __LINE__)); 1075 1124 goto dropafterack; 1125 } 1076 1126 } 1077 1127 else … … 1111 1161 case TCPS_SYN_RECEIVED: 1112 1162 /* so->so_error = ECONNREFUSED; */ 1163 LogFlowFunc(("%d -> close\n", __LINE__)); 1113 1164 goto close; 1114 1165 … … 1119 1170 /* so->so_error = ECONNRESET; */ 1120 1171 close: 1121 tp->t_state = TCPS_CLOSED; 1122 tcpstat.tcps_drops++; 1123 tp = tcp_close(pData, tp); 1124 goto drop; 1172 LogFlowFunc(("close:\n")); 1173 tp->t_state = TCPS_CLOSED; 1174 tcpstat.tcps_drops++; 1175 tp = tcp_close(pData, tp); 1176 LogFlowFunc(("%d -> drop\n", __LINE__)); 1177 goto drop; 1125 1178 1126 1179 case TCPS_CLOSING: 1127 1180 case TCPS_LAST_ACK: 1128 1181 case TCPS_TIME_WAIT: 1129 tp = tcp_close(pData, tp); 1130 goto drop; 1182 tp = tcp_close(pData, tp); 1183 LogFlowFunc(("%d -> drop\n", __LINE__)); 1184 goto drop; 1131 1185 } 1132 1186 … … 1138 1192 { 1139 1193 tp = tcp_drop(pData, tp, 0); 1194 LogFlowFunc(("%d -> dropwithreset\n", __LINE__)); 1140 1195 goto dropwithreset; 1141 1196 } … … 1146 1201 if ((tiflags & TH_ACK) == 0) 1147 1202 { 1203 LogFlowFunc(("%d -> drop\n", __LINE__)); 1148 1204 goto drop; 1149 1205 } … … 1187 1243 tp->snd_wl1 = ti->ti_seq - 1; 1188 1244 /* Avoid ack processing; snd_una==ti_ack => dup ack */ 1245 LogFlowFunc(("%d -> synrx_to_est\n", __LINE__)); 1189 1246 goto synrx_to_est; 1190 1247 /* fall into ... */ … … 1254 1311 if (SEQ_GT(onxt, tp->snd_nxt)) 1255 1312 tp->snd_nxt = onxt; 1313 LogFlowFunc(("%d -> drop\n", __LINE__)); 1256 1314 goto drop; 1257 1315 } … … 1260 1318 tp->snd_cwnd += tp->t_maxseg; 1261 1319 (void) tcp_output(pData, tp); 1320 LogFlowFunc(("%d -> drop\n", __LINE__)); 1262 1321 goto drop; 1263 1322 } … … 1268 1327 } 1269 1328 synrx_to_est: 1329 LogFlowFunc(("%d -> synrx_to_est:\n")); 1270 1330 /* 1271 1331 * If the congestion window was inflated to account … … 1279 1339 { 1280 1340 tcpstat.tcps_rcvacktoomuch++; 1341 LogFlowFunc(("%d -> dropafterack\n", __LINE__)); 1281 1342 goto dropafterack; 1282 1343 } … … 1414 1475 { 1415 1476 tp = tcp_close(pData, tp); 1477 LogFlowFunc(("%d -> drop\n", __LINE__)); 1416 1478 goto drop; 1417 1479 } … … 1425 1487 case TCPS_TIME_WAIT: 1426 1488 tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; 1489 LogFlowFunc(("%d -> dropafterack\n", __LINE__)); 1427 1490 goto dropafterack; 1428 1491 } … … 1430 1493 1431 1494 step6: 1495 LogFlowFunc(("step6:\n")); 1432 1496 /* 1433 1497 * Update window information. … … 1472 1536 ti->ti_urp = 0; 1473 1537 tiflags &= ~TH_URG; 1538 LogFlowFunc(("%d -> dodata\n", __LINE__)); 1474 1539 goto dodata; 1475 1540 } … … 1506 1571 tp->rcv_up = tp->rcv_nxt; 1507 1572 dodata: 1573 LogFlowFunc(("dodata:\n")); 1508 1574 1509 1575 /* … … 1635 1701 SOCKET_UNLOCK(so); 1636 1702 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 1703 LogFlowFuncLeave(); 1637 1704 return; 1638 1705 1639 1706 dropafterack: 1640 Log 2(("drop after ack\n"));1707 LogFlowFunc(("dropafterack:\n")); 1641 1708 /* 1642 1709 * Generate an ACK dropping incoming segment if it occupies … … 1644 1711 */ 1645 1712 if (tiflags & TH_RST) 1713 { 1714 LogFlowFunc(("%d -> drop\n", __LINE__)); 1646 1715 goto drop; 1716 } 1647 1717 m_freem(pData, m); 1648 1718 tp->t_flags |= TF_ACKNOW; … … 1650 1720 SOCKET_UNLOCK(so); 1651 1721 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 1722 LogFlowFuncLeave(); 1652 1723 return; 1653 1724 1654 1725 dropwithreset: 1726 LogFlowFunc(("dropwithreset:\n")); 1655 1727 /* reuses m if m!=NULL, m_free() unnecessary */ 1656 1728 if (tiflags & TH_ACK) … … 1667 1739 SOCKET_UNLOCK(so); 1668 1740 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 1741 LogFlowFuncLeave(); 1669 1742 return; 1670 1743 1671 1744 drop: 1745 LogFlowFunc(("drop:\n")); 1672 1746 /* 1673 1747 * Drop space held by incoming segment and return. … … 1683 1757 1684 1758 STAM_PROFILE_STOP(&pData->StatTCP_input, counter_input); 1759 LogFlowFuncLeave(); 1685 1760 return; 1686 1761 }
Note:
See TracChangeset
for help on using the changeset viewer.