Changeset 14638 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Nov 26, 2008 1:28:38 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip.h
r14616 r14638 208 208 typedef caddr_t caddr32_t; 209 209 # else 210 # if !defined(VBOX_WITH_BSD_REASS) && !defined(VBOX_WITH_BSD_TCP_REASS)210 # if !defined(VBOX_WITH_BSD_REASS) 211 211 typedef u_int32_t caddr32_t; 212 # else /* !VBOX_WITH_BSD_REASS && !VBOX_WITH_BSD_TCP_REASS*/212 # else /* VBOX_WITH_BSD_REASS */ 213 213 typedef caddr_t caddr32_t; 214 # endif /* VBOX_WITH_BSD_REASS || VBOX_WITH_BSD_TCP_REASS*/214 # endif /* VBOX_WITH_BSD_REASS */ 215 215 # endif 216 216 #endif … … 228 228 */ 229 229 struct ipovly { 230 #if !defined(VBOX_WITH_BSD_REASS) && !defined(VBOX_WITH_BSD_TCP_REASS)230 #if !defined(VBOX_WITH_BSD_REASS) 231 231 caddr32_t ih_next, ih_prev; /* for protocol sequence q's */ 232 232 u_int8_t ih_x1; /* (unused) */ 233 #else /* !VBOX_WITH_BSD_REASS && !VBOX_WITH_BSD_TCP_REASS */233 #else /* VBOX_WITH_BSD_REASS */ 234 234 u_int8_t ih_x1[9]; /* (unused) */ 235 #endif /* VBOX_WITH_BSD_REASS || VBOX_WITH_BSD_TCP_REASS*/235 #endif /* VBOX_WITH_BSD_REASS */ 236 236 u_int8_t ih_pr; /* protocol */ 237 237 u_int16_t ih_len; /* protocol length */ -
trunk/src/VBox/Devices/Network/slirp/misc.c
r14567 r14638 32 32 } 33 33 34 #if !defined(VBOX_WITH_BSD_REASS) && !defined(VBOX_WITH_BSD_TCP_REASS) 35 #if SIZEOF_CHAR_P == 8 34 #if SIZEOF_CHAR_P == 8 && !defined(VBOX_WITH_BSD_REASS) 36 35 37 36 struct quehead_32 { … … 66 65 } 67 66 68 #endif /* SIZEOF_CHAR_P == 8 */ 69 #endif /* !VBOX_WITH_BSD_REASS && !VBOX_WITH_BSD_TCP_REASS*/ 67 #endif /* SIZEOF_CHAR_P == 8 && !VBOX_WITH_BSD_REASS */ 70 68 71 69 struct quehead { -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r14529 r14638 21 21 const char **ppszDomain) 22 22 { 23 int rc = 0;24 FIXED_INFO *FixedInfo =NULL;25 ULONG 26 DWORD 23 int rc = 0; 24 FIXED_INFO *FixedInfo = NULL; 25 ULONG BufLen; 26 DWORD ret; 27 27 IP_ADDR_STRING *pIPAddr; 28 28 struct in_addr tmp_addr; … … 34 34 * corresponding network adapter is disabled or not. Maybe replace 35 35 * this by GetAdapterAddresses(), which is XP/Vista only though. */ 36 if (ERROR_BUFFER_OVERFLOW == GetNetworkParams(FixedInfo, &BufLen)) { 37 if (FixedInfo) { 36 if (ERROR_BUFFER_OVERFLOW == GetNetworkParams(FixedInfo, &BufLen)) 37 { 38 if (FixedInfo) 39 { 38 40 GlobalFree(FixedInfo); 39 41 FixedInfo = NULL; … … 42 44 } 43 45 44 if ((ret = GetNetworkParams(FixedInfo, &BufLen)) != ERROR_SUCCESS) { 46 if ((ret = GetNetworkParams(FixedInfo, &BufLen)) != ERROR_SUCCESS) 47 { 45 48 Log(("GetNetworkParams failed. ret = %08x\n", (u_int)ret )); 46 if (FixedInfo) { 49 if (FixedInfo) 50 { 47 51 GlobalFree(FixedInfo); 48 52 FixedInfo = NULL; … … 60 64 61 65 pIPAddr = FixedInfo -> DnsServerList.Next; 62 while ( pIPAddr)66 while (pIPAddr) 63 67 { 64 68 if (fVerbose) … … 66 70 pIPAddr = pIPAddr ->Next; 67 71 } 68 if (FixedInfo) { 72 if (FixedInfo) 73 { 69 74 GlobalFree(FixedInfo); 70 75 FixedInfo = NULL; … … 126 131 f = fopen(buff, "rt"); 127 132 } 128 if (!f) { 133 if (!f) 134 { 129 135 snprintf(buff, sizeof(buff), "%s/RESOLV2", _PATH_ETC); 130 136 f = fopen(buff, "rt"); 131 137 } 132 if (!f) { 138 if (!f) 139 { 133 140 snprintf(buff, sizeof(buff), "%s/resolv.conf", _PATH_ETC); 134 141 f = fopen(buff, "rt"); … … 143 150 *ppszDomain = NULL; 144 151 Log(("nat: DNS Servers:\n")); 145 while (fgets(buff, 512, f) != NULL) { 146 if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { 152 while (fgets(buff, 512, f) != NULL) 153 { 154 if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) 155 { 147 156 if (!inet_aton(buff2, &tmp_addr)) 148 157 continue; … … 227 236 } 228 237 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 229 238 pData->phEvents[VBOX_SOCKET_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); 230 239 #endif 231 240 #endif … … 315 324 RTStrFree((char *)(void *)pData->pszDomain); 316 325 317 #if ARCH_BITS == 64 326 #if ARCH_BITS == 64 && !defined(VBOX_WITH_BSD_REASS) 318 327 LogRel(("NAT: cpvHashUsed=%RU32 cpvHashCollisions=%RU32 cpvHashInserts=%RU64 cpvHashDone=%RU64\n", 319 328 pData->cpvHashUsed, pData->cpvHashCollisions, pData->cpvHashInserts, pData->cpvHashDone)); … … 344 353 345 354 #define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED) 346 #define CONN_CANFRCV(so) (((so)->so_state & (SS_FCANTRCVMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED)347 #define UPD_NFDS(x) if (nfds < (x)) nfds = (x)355 #define CONN_CANFRCV(so) (((so)->so_state & (SS_FCANTRCVMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED) 356 #define UPD_NFDS(x) if (nfds < (x)) nfds = (x) 348 357 349 358 /* … … 388 397 389 398 nfds = *pnfds; 399 400 /* 401 * First, TCP sockets 402 */ 403 do_slowtimo = 0; 404 if (link_up) 405 { 390 406 /* 391 * First, TCP sockets 407 * *_slowtimo needs calling if there are IP fragments 408 * in the fragment queue, or there are TCP connections active 392 409 */ 393 do_slowtimo = 0;394 if (link_up) {395 /*396 * *_slowtimo needs calling if there are IP fragments397 * in the fragment queue, or there are TCP connections active398 */399 410 #ifndef VBOX_WITH_BSD_REASS 400 do_slowtimo = ((tcb.so_next != &tcb) ||401 411 do_slowtimo = ((tcb.so_next != &tcb) 412 || ((struct ipasfrag *)&ipq != u32_to_ptr(pData, ipq.next, struct ipasfrag *))); 402 413 #else /* !VBOX_WITH_BSD_REASS */ 403 /* XXX: triggering of fragment expiration should be the same but use 404 * new macroses 405 */ 406 for (i = 0; i < IPREASS_NHASH; i++) { 407 if (!TAILQ_EMPTY(&ipq[i])) { 408 do_slowtimo = 1; 409 break; 410 } 414 /* XXX: 415 * triggering of fragment expiration should be the same but use new macroses 416 */ 417 for (i = 0; i < IPREASS_NHASH; i++) 418 { 419 if (!TAILQ_EMPTY(&ipq[i])) 420 { 421 do_slowtimo = 1; 422 break; 423 } 424 } 425 do_slowtimo |= (tcb.so_next != &tcb); 426 #endif /* VBOX_WITH_BSD_REASS */ 427 428 STAM_REL_COUNTER_RESET(&pData->StatTCP); 429 STAM_REL_COUNTER_RESET(&pData->StatTCPHot); 430 431 for (so = tcb.so_next; so != &tcb; so = so_next) 432 { 433 so_next = so->so_next; 434 435 STAM_REL_COUNTER_INC(&pData->StatTCP); 436 437 /* 438 * See if we need a tcp_fasttimo 439 */ 440 if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK) 441 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 442 443 /* 444 * NOFDREF can include still connecting to local-host, 445 * newly socreated() sockets etc. Don't want to select these. 446 */ 447 if (so->so_state & SS_NOFDREF || so->s == -1) 448 continue; 449 450 /* 451 * Set for reading sockets which are accepting 452 */ 453 if (so->so_state & SS_FACCEPTCONN) 454 { 455 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 456 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 457 FD_SET(so->s, readfds); 458 UPD_NFDS(so->s); 459 #else 460 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 461 if (rc == SOCKET_ERROR) 462 { 463 socket_error: 464 error = WSAGetLastError(); 465 LogRel(("WSAEventSelector error %d (so=%x, socket=%s, event=%x)\n", error, so, so->s, VBOX_SOCKET_EVENT)); 411 466 } 412 do_slowtimo |= (tcb.so_next != &tcb); 413 #endif /* VBOX_WITH_BSD_REASS */ 414 415 STAM_REL_COUNTER_RESET(&pData->StatTCP); 416 STAM_REL_COUNTER_RESET(&pData->StatTCPHot); 417 418 for (so = tcb.so_next; so != &tcb; so = so_next) { 419 so_next = so->so_next; 420 421 STAM_REL_COUNTER_INC(&pData->StatTCP); 422 423 /* 424 * See if we need a tcp_fasttimo 425 */ 426 if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK) 427 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 428 429 /* 430 * NOFDREF can include still connecting to local-host, 431 * newly socreated() sockets etc. Don't want to select these. 432 */ 433 if (so->so_state & SS_NOFDREF || so->s == -1) 434 continue; 435 436 /* 437 * Set for reading sockets which are accepting 438 */ 439 if (so->so_state & SS_FACCEPTCONN) { 440 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 467 #endif 468 continue; 469 } 470 471 /* 472 * Set for writing sockets which are connecting 473 */ 474 if (so->so_state & SS_ISFCONNECTING) 475 { 476 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 441 477 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 442 FD_SET(so->s, readfds); 443 UPD_NFDS(so->s); 444 #else 445 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 446 if (rc == SOCKET_ERROR) 447 { 448 socket_error: 449 error = WSAGetLastError(); 450 LogRel(("WSAEventSelector error %d (so=%x, socket=%s, event=%x)\n", error, so, so->s, VBOX_SOCKET_EVENT)); 451 } 452 #endif 453 continue; 454 } 455 456 /* 457 * Set for writing sockets which are connecting 458 */ 459 if (so->so_state & SS_ISFCONNECTING) { 460 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 478 FD_SET(so->s, writefds); 479 UPD_NFDS(so->s); 480 #else 481 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 482 if (rc == SOCKET_ERROR) 483 goto socket_error; 484 #endif 485 continue; 486 } 487 488 /* 489 * Set for writing if we are connected, can send more, and 490 * we have something to send 491 */ 492 if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) 493 { 494 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 461 495 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 462 FD_SET(so->s, writefds); 463 UPD_NFDS(so->s); 464 #else 465 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 466 if (rc == SOCKET_ERROR) 467 goto socket_error; 468 #endif 469 continue; 470 } 471 472 /* 473 * Set for writing if we are connected, can send more, and 474 * we have something to send 475 */ 476 if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) { 477 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 496 FD_SET(so->s, writefds); 497 UPD_NFDS(so->s); 498 #else 499 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 500 if (rc == SOCKET_ERROR) 501 goto socket_error; 502 continue; /* we're using the widest mask for event */ 503 #endif 504 } 505 506 /* 507 * Set for reading (and urgent data) if we are connected, can 508 * receive more, and we have room for it XXX /2 ? 509 */ 510 if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) 511 { 512 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 478 513 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 479 FD_SET(so->s, writefds); 480 UPD_NFDS(so->s); 481 #else 482 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_OOB); 483 if (rc == SOCKET_ERROR) 484 goto socket_error; 485 continue; /*XXX: we're using the widest mask for event*/ 486 #endif 487 } 488 489 /* 490 * Set for reading (and urgent data) if we are connected, can 491 * receive more, and we have room for it XXX /2 ? 492 */ 493 if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) { 494 STAM_REL_COUNTER_INC(&pData->StatTCPHot); 514 FD_SET(so->s, readfds); 515 FD_SET(so->s, xfds); 516 UPD_NFDS(so->s); 517 #else 518 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_OOB|FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT); 519 if (rc == SOCKET_ERROR) 520 goto socket_error; 521 continue; /* we're using the widest mask for event */ 522 #endif 523 } 524 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 525 rc = WSAEventSelect(so->s, NULL, 0); 526 if (rc == SOCKET_ERROR) 527 goto socket_error; 528 #endif 529 } 530 531 /* 532 * UDP sockets 533 */ 534 STAM_REL_COUNTER_RESET(&pData->StatUDP); 535 STAM_REL_COUNTER_RESET(&pData->StatUDPHot); 536 537 for (so = udb.so_next; so != &udb; so = so_next) 538 { 539 so_next = so->so_next; 540 541 STAM_REL_COUNTER_INC(&pData->StatUDP); 542 543 /* 544 * See if it's timed out 545 */ 546 if (so->so_expire) 547 { 548 if (so->so_expire <= curtime) 549 { 550 udp_detach(pData, so); 551 continue; 552 } 553 else 554 do_slowtimo = 1; /* Let socket expire */ 555 } 556 557 /* 558 * When UDP packets are received from over the link, they're 559 * sendto()'d straight away, so no need for setting for writing 560 * Limit the number of packets queued by this session to 4. 561 * Note that even though we try and limit this to 4 packets, 562 * the session could have more queued if the packets needed 563 * to be fragmented. 564 * 565 * (XXX <= 4 ?) 566 */ 567 if ((so->so_state & SS_ISFCONNECTED) && so->so_queued <= 4) 568 { 569 STAM_REL_COUNTER_INC(&pData->StatUDPHot); 495 570 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 496 FD_SET(so->s, readfds); 497 FD_SET(so->s, xfds); 498 UPD_NFDS(so->s); 499 #else 500 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_OOB|FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT); 501 if (rc == SOCKET_ERROR) 502 goto socket_error; 503 continue; /*XXX: we're using the widest mask for event*/ 504 #endif 505 } 571 FD_SET(so->s, readfds); 572 UPD_NFDS(so->s); 573 #else 574 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT); 575 if (rc == SOCKET_ERROR) 576 goto socket_error; 577 continue; 578 #endif 579 } 506 580 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 507 rc = WSAEventSelect(so->s, NULL, 0); 508 if (rc == SOCKET_ERROR) 509 goto socket_error; 510 #endif 511 } 512 513 /* 514 * UDP sockets 515 */ 516 STAM_REL_COUNTER_RESET(&pData->StatUDP); 517 STAM_REL_COUNTER_RESET(&pData->StatUDPHot); 518 519 for (so = udb.so_next; so != &udb; so = so_next) { 520 so_next = so->so_next; 521 522 STAM_REL_COUNTER_INC(&pData->StatUDP); 523 524 /* 525 * See if it's timed out 526 */ 527 if (so->so_expire) { 528 if (so->so_expire <= curtime) { 529 udp_detach(pData, so); 530 continue; 531 } else 532 do_slowtimo = 1; /* Let socket expire */ 533 } 534 535 /* 536 * When UDP packets are received from over the 537 * link, they're sendto()'d straight away, so 538 * no need for setting for writing 539 * Limit the number of packets queued by this session 540 * to 4. Note that even though we try and limit this 541 * to 4 packets, the session could have more queued 542 * if the packets needed to be fragmented 543 * (XXX <= 4 ?) 544 */ 545 if ((so->so_state & SS_ISFCONNECTED) && so->so_queued <= 4) { 546 STAM_REL_COUNTER_INC(&pData->StatUDPHot); 581 else 582 { 583 rc = WSAEventSelect(so->s, NULL, 0); 584 if (rc != SOCKET_ERROR) 585 goto socket_error; 586 } 587 #endif 588 } 589 } 590 547 591 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 548 FD_SET(so->s, readfds); 549 UPD_NFDS(so->s); 550 #else 551 rc = WSAEventSelect(so->s, VBOX_SOCKET_EVENT, FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT); 552 if (rc == SOCKET_ERROR) 553 goto socket_error; 554 continue; 555 #endif 556 } 557 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 558 else 559 { 560 rc = WSAEventSelect(so->s, NULL, 0); 561 if (rc != SOCKET_ERROR) 562 goto socket_error; 563 } 564 #endif 565 } 566 } 567 568 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 569 *pnfds = nfds; 570 #else 571 *pnfds = VBOX_EVENT_COUNT; 592 *pnfds = nfds; 593 #else 594 *pnfds = VBOX_EVENT_COUNT; 572 595 #endif 573 596 … … 580 603 int ret; 581 604 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 582 WSANETWORKEVENTS NetworkEvents; 583 int rc; 584 int error; 585 int timer_update = (readfds == NULL && writefds == NULL && xfds == NULL); 586 #endif 587 STAM_REL_PROFILE_START(&pData->StatPoll, a); 588 589 /* Update time */ 590 updtime(pData); 591 605 WSANETWORKEVENTS NetworkEvents; 606 int rc; 607 int error; 608 #endif 609 STAM_REL_PROFILE_START(&pData->StatPoll, a); 610 611 /* Update time */ 612 updtime(pData); 613 614 /* 615 * See if anything has timed out 616 */ 617 if (link_up) 618 { 619 if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) 620 { 621 STAM_REL_PROFILE_START(&pData->StatFastTimer, a); 622 tcp_fasttimo(pData); 623 time_fasttimo = 0; 624 STAM_REL_PROFILE_STOP(&pData->StatFastTimer, a); 625 } 626 if (do_slowtimo && ((curtime - last_slowtimo) >= 499)) 627 { 628 STAM_REL_PROFILE_START(&pData->StatSlowTimer, a); 629 ip_slowtimo(pData); 630 tcp_slowtimo(pData); 631 last_slowtimo = curtime; 632 STAM_REL_PROFILE_STOP(&pData->StatSlowTimer, a); 633 } 634 } 635 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 636 if (!readfds && !writefds && !xfds) 637 return; /* only timer update */ 638 #endif 639 640 /* 641 * Check sockets 642 */ 643 if (link_up) 644 { 592 645 /* 593 * See if anything has timed out646 * Check TCP sockets 594 647 */ 595 if (link_up) { 596 if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) { 597 STAM_REL_PROFILE_START(&pData->StatFastTimer, a); 598 tcp_fasttimo(pData); 599 time_fasttimo = 0; 600 STAM_REL_PROFILE_STOP(&pData->StatFastTimer, a); 648 for (so = tcb.so_next; so != &tcb; so = so_next) 649 { 650 so_next = so->so_next; 651 652 /* 653 * FD_ISSET is meaningless on these sockets 654 * (and they can crash the program) 655 */ 656 if (so->so_state & SS_NOFDREF || so->s == -1) 657 continue; 658 659 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 660 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 661 if (rc == SOCKET_ERROR) 662 { 663 error = WSAGetLastError(); 664 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error)); 665 continue; 666 } 667 #endif 668 669 /* 670 * Check for URG data 671 * This will soread as well, so no need to 672 * test for readfds below if this succeeds 673 */ 674 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 675 if (FD_ISSET(so->s, xfds)) 676 #else 677 /* out-of-band data */ 678 if ((NetworkEvents.lNetworkEvents & FD_OOB) && NetworkEvents.iErrorCode[FD_OOB_BIT] == 0) 679 #endif 680 { 681 sorecvoob(pData, so); 682 } 683 684 /* 685 * Check sockets for reading 686 */ 687 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 688 else if (FD_ISSET(so->s, readfds)) 689 #else 690 else if ((NetworkEvents.lNetworkEvents & FD_READ) && (NetworkEvents.iErrorCode[FD_READ_BIT] == 0)) 691 #endif 692 { 693 /* 694 * Check for incoming connections 695 */ 696 if (so->so_state & SS_FACCEPTCONN) 697 { 698 tcp_connect(pData, so); 699 continue; 601 700 } 602 if (do_slowtimo && ((curtime - last_slowtimo) >= 499)) { 603 STAM_REL_PROFILE_START(&pData->StatSlowTimer, a); 604 ip_slowtimo(pData); 605 tcp_slowtimo(pData); 606 last_slowtimo = curtime; 607 STAM_REL_PROFILE_STOP(&pData->StatSlowTimer, a); 701 702 ret = soread(pData, so); 703 /* Output it if we read something */ 704 if (ret > 0) 705 tcp_output(pData, sototcpcb(so)); 706 } 707 708 /* 709 * Check sockets for writing 710 */ 711 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 712 if (FD_ISSET(so->s, writefds)) 713 #else 714 if ((NetworkEvents.lNetworkEvents & FD_WRITE) && (NetworkEvents.iErrorCode[FD_WRITE_BIT] == 0)) 715 #endif 716 { 717 /* 718 * Check for non-blocking, still-connecting sockets 719 */ 720 if (so->so_state & SS_ISFCONNECTING) 721 { 722 /* Connected */ 723 so->so_state &= ~SS_ISFCONNECTING; 724 725 /* 726 * This should be probably guarded by PROBE_CONN too. Anyway, 727 * we disable it on OS/2 because the below send call returns 728 * EFAULT which causes the opened TCP socket to close right 729 * after it has been opened and connected. 730 */ 731 #ifndef RT_OS_OS2 732 ret = send(so->s, (const char *)&ret, 0, 0); 733 if (ret < 0) 734 { 735 /* XXXXX Must fix, zero bytes is a NOP */ 736 if ( errno == EAGAIN 737 || errno == EWOULDBLOCK 738 || errno == EINPROGRESS 739 || errno == ENOTCONN) 740 continue; 741 742 /* else failed */ 743 so->so_state = SS_NOFDREF; 744 } 745 /* else so->so_state &= ~SS_ISFCONNECTING; */ 746 #endif 747 748 /* 749 * Continue tcp_input 750 */ 751 tcp_input(pData, (struct mbuf *)NULL, sizeof(struct ip), so); 752 /* continue; */ 753 } else 754 ret = sowrite(pData, so); 755 /* 756 * XXXXX If we wrote something (a lot), there 757 * could be a need for a window update. 758 * In the worst case, the remote will send 759 * a window probe to get things going again 760 */ 761 } 762 763 /* 764 * Probe a still-connecting, non-blocking socket 765 * to check if it's still alive 766 */ 767 #ifdef PROBE_CONN 768 if (so->so_state & SS_ISFCONNECTING) 769 { 770 ret = recv(so->s, (char *)&ret, 0, 0); 771 772 if (ret < 0) 773 { 774 /* XXX */ 775 if ( errno == EAGAIN 776 || errno == EWOULDBLOCK 777 || errno == EINPROGRESS 778 || errno == ENOTCONN) 779 { 780 continue; /* Still connecting, continue */ 781 } 782 783 /* else failed */ 784 so->so_state = SS_NOFDREF; 785 786 /* tcp_input will take care of it */ 608 787 } 609 } 610 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 611 if (timer_update) return; 612 #endif 613 614 /* 615 * Check sockets 616 */ 617 if (link_up) { 618 /* 619 * Check TCP sockets 620 */ 621 for (so = tcb.so_next; so != &tcb; so = so_next) { 622 so_next = so->so_next; 623 624 /* 625 * FD_ISSET is meaningless on these sockets 626 * (and they can crash the program) 627 */ 628 if (so->so_state & SS_NOFDREF || so->s == -1) 629 continue; 630 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 631 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 632 if (rc == SOCKET_ERROR) 788 else 789 { 790 ret = send(so->s, &ret, 0, 0); 791 if (ret < 0) 792 { 793 /* XXX */ 794 if ( errno == EAGAIN 795 || errno == EWOULDBLOCK 796 || errno == EINPROGRESS 797 || errno == ENOTCONN) 633 798 { 634 error = WSAGetLastError();635 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error));636 799 continue; 637 800 } 638 #endif 639 640 /* 641 * Check for URG data 642 * This will soread as well, so no need to 643 * test for readfds below if this succeeds 644 */ 801 /* else failed */ 802 so->so_state = SS_NOFDREF; 803 } 804 else 805 so->so_state &= ~SS_ISFCONNECTING; 806 807 } 808 tcp_input((struct mbuf *)NULL, sizeof(struct ip),so); 809 } /* SS_ISFCONNECTING */ 810 #endif 811 } 812 813 /* 814 * Now UDP sockets. 815 * Incoming packets are sent straight away, they're not buffered. 816 * Incoming UDP data isn't buffered either. 817 */ 818 for (so = udb.so_next; so != &udb; so = so_next) 819 { 820 so_next = so->so_next; 821 822 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 823 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 824 if (rc == SOCKET_ERROR) 825 { 826 error = WSAGetLastError(); 827 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error)); 828 continue; 829 } 830 #endif 645 831 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 646 if (FD_ISSET(so->s, xfds)) 647 #else 648 /* out-of-band data */ 649 if ((NetworkEvents.lNetworkEvents & FD_OOB) && NetworkEvents.iErrorCode[FD_OOB_BIT] == 0) 650 #endif 651 sorecvoob(pData, so); 652 /* 653 * Check sockets for reading 654 */ 655 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 656 else if (FD_ISSET(so->s, readfds)) { 657 #else 658 else if ((NetworkEvents.lNetworkEvents & FD_READ) && (NetworkEvents.iErrorCode[FD_READ_BIT] == 0)) { 659 #endif 660 /* 661 * Check for incoming connections 662 */ 663 if (so->so_state & SS_FACCEPTCONN) { 664 tcp_connect(pData, so); 665 continue; 666 } /* else */ 667 ret = soread(pData, so); 668 669 /* Output it if we read something */ 670 if (ret > 0) 671 tcp_output(pData, sototcpcb(so)); 672 } 673 674 /* 675 * Check sockets for writing 676 */ 677 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 678 if (FD_ISSET(so->s, writefds)) { 679 #else 680 if ((NetworkEvents.lNetworkEvents & FD_WRITE) && (NetworkEvents.iErrorCode[FD_WRITE_BIT] == 0)) { 681 #endif 682 /* 683 * Check for non-blocking, still-connecting sockets 684 */ 685 if (so->so_state & SS_ISFCONNECTING) { 686 /* Connected */ 687 so->so_state &= ~SS_ISFCONNECTING; 688 689 /* 690 * This should be probably guarded by PROBE_CONN too. Anyway, 691 * we disable it on OS/2 because the below send call returns 692 * EFAULT which causes the opened TCP socket to close right 693 * after it has been opened and connected. 694 */ 695 #ifndef RT_OS_OS2 696 ret = send(so->s, (const char *)&ret, 0, 0); 697 if (ret < 0) { 698 /* XXXXX Must fix, zero bytes is a NOP */ 699 if (errno == EAGAIN || errno == EWOULDBLOCK || 700 errno == EINPROGRESS || errno == ENOTCONN) { 701 continue; 702 } 703 704 /* else failed */ 705 so->so_state = SS_NOFDREF; 706 } 707 /* else so->so_state &= ~SS_ISFCONNECTING; */ 708 #endif 709 710 /* 711 * Continue tcp_input 712 */ 713 tcp_input(pData, (struct mbuf *)NULL, sizeof(struct ip), so); 714 /* continue; */ 715 } else 716 ret = sowrite(pData, so); 717 /* 718 * XXXXX If we wrote something (a lot), there 719 * could be a need for a window update. 720 * In the worst case, the remote will send 721 * a window probe to get things going again 722 */ 723 } 724 725 /* 726 * Probe a still-connecting, non-blocking socket 727 * to check if it's still alive 728 */ 729 #ifdef PROBE_CONN 730 if (so->so_state & SS_ISFCONNECTING) { 731 ret = recv(so->s, (char *)&ret, 0,0); 732 733 if (ret < 0) { 734 /* XXX */ 735 if (errno == EAGAIN || errno == EWOULDBLOCK || 736 errno == EINPROGRESS || errno == ENOTCONN) { 737 continue; /* Still connecting, continue */ 738 } 739 740 /* else failed */ 741 so->so_state = SS_NOFDREF; 742 743 /* tcp_input will take care of it */ 744 } else { 745 ret = send(so->s, &ret, 0,0); 746 if (ret < 0) { 747 /* XXX */ 748 if (errno == EAGAIN || errno == EWOULDBLOCK || 749 errno == EINPROGRESS || errno == ENOTCONN) { 750 continue; 751 } 752 /* else failed */ 753 so->so_state = SS_NOFDREF; 754 } else 755 so->so_state &= ~SS_ISFCONNECTING; 756 757 } 758 tcp_input((struct mbuf *)NULL, sizeof(struct ip),so); 759 } /* SS_ISFCONNECTING */ 760 #endif 761 } 762 763 /* 764 * Now UDP sockets. 765 * Incoming packets are sent straight away, they're not buffered. 766 * Incoming UDP data isn't buffered either. 767 */ 768 for (so = udb.so_next; so != &udb; so = so_next) { 769 so_next = so->so_next; 770 771 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 772 rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents); 773 if (rc == SOCKET_ERROR) 774 { 775 error = WSAGetLastError(); 776 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error)); 777 continue; 778 } 779 #endif 780 #if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS) 781 if (so->s != -1 && FD_ISSET(so->s, readfds)) { 782 #else 783 if ((NetworkEvents.lNetworkEvents & FD_READ) && (NetworkEvents.iErrorCode[FD_READ_BIT] == 0)) { 784 #endif 785 sorecvfrom(pData, so); 786 } 787 } 788 } 789 790 /* 791 * See if we can start outputting 792 */ 793 if (if_queued && link_up) 794 if_start(pData); 795 796 STAM_REL_PROFILE_STOP(&pData->StatPoll, a); 832 if (so->s != -1 && FD_ISSET(so->s, readfds)) 833 #else 834 if ((NetworkEvents.lNetworkEvents & FD_READ) && (NetworkEvents.iErrorCode[FD_READ_BIT] == 0)) 835 #endif 836 { 837 sorecvfrom(pData, so); 838 } 839 } 840 } 841 842 /* 843 * See if we can start outputting 844 */ 845 if (if_queued && link_up) 846 if_start(pData); 847 848 STAM_REL_PROFILE_STOP(&pData->StatPoll, a); 797 849 } 798 850 … … 843 895 844 896 ar_op = ntohs(ah->ar_op); 845 switch(ar_op) { 846 case ARPOP_REQUEST: 847 if ((htip & pData->netmask) == ntohl(special_addr.s_addr)) { 848 if ( (htip & ~pData->netmask) == CTL_DNS 849 || (htip & ~pData->netmask) == CTL_ALIAS) 850 goto arp_ok; 851 for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { 852 if ((htip & ~pData->netmask) == ex_ptr->ex_addr) 897 switch(ar_op) 898 { 899 case ARPOP_REQUEST: 900 if ((htip & pData->netmask) == ntohl(special_addr.s_addr)) 901 { 902 if ( (htip & ~pData->netmask) == CTL_DNS 903 || (htip & ~pData->netmask) == CTL_ALIAS) 853 904 goto arp_ok; 854 } 855 return; 905 for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) 906 { 907 if ((htip & ~pData->netmask) == ex_ptr->ex_addr) 908 goto arp_ok; 909 } 910 return; 856 911 arp_ok: 857 /* XXX: make an ARP request to have the client address */858 memcpy(client_ethaddr, eh->h_source, ETH_ALEN);859 860 /* ARP request for alias/dns mac address */861 memcpy(reh->h_dest, pkt + ETH_ALEN, ETH_ALEN);862 memcpy(reh->h_source, special_ethaddr, ETH_ALEN - 1);863 reh->h_source[5] = ah->ar_tip[3];864 reh->h_proto = htons(ETH_P_ARP);865 866 rah->ar_hrd = htons(1);867 rah->ar_pro = htons(ETH_P_IP);868 rah->ar_hln = ETH_ALEN;869 rah->ar_pln = 4;870 rah->ar_op = htons(ARPOP_REPLY);871 memcpy(rah->ar_sha, reh->h_source, ETH_ALEN);872 memcpy(rah->ar_sip, ah->ar_tip, 4);873 memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN);874 memcpy(rah->ar_tip, ah->ar_sip, 4);875 slirp_output(pData->pvUser, arp_reply, sizeof(arp_reply));876 }877 break;878 default:879 break;912 /* XXX: make an ARP request to have the client address */ 913 memcpy(client_ethaddr, eh->h_source, ETH_ALEN); 914 915 /* ARP request for alias/dns mac address */ 916 memcpy(reh->h_dest, pkt + ETH_ALEN, ETH_ALEN); 917 memcpy(reh->h_source, special_ethaddr, ETH_ALEN - 1); 918 reh->h_source[5] = ah->ar_tip[3]; 919 reh->h_proto = htons(ETH_P_ARP); 920 921 rah->ar_hrd = htons(1); 922 rah->ar_pro = htons(ETH_P_IP); 923 rah->ar_hln = ETH_ALEN; 924 rah->ar_pln = 4; 925 rah->ar_op = htons(ARPOP_REPLY); 926 memcpy(rah->ar_sha, reh->h_source, ETH_ALEN); 927 memcpy(rah->ar_sip, ah->ar_tip, 4); 928 memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); 929 memcpy(rah->ar_tip, ah->ar_sip, 4); 930 slirp_output(pData->pvUser, arp_reply, sizeof(arp_reply)); 931 } 932 break; 933 default: 934 break; 880 935 } 881 936 } … … 890 945 891 946 proto = ntohs(*(uint16_t *)(pkt + 12)); 892 switch(proto) { 893 case ETH_P_ARP: 894 arp_input(pData, pkt, pkt_len); 895 break; 896 case ETH_P_IP: 897 /* Update time. Important if the network is very quiet, as otherwise 898 * the first outgoing connection gets an incorrect timestamp. */ 899 updtime(pData); 900 901 m = m_get(pData); 902 if (!m) 903 return; 904 /* Note: we add to align the IP header */ 905 if (M_FREEROOM(m) < pkt_len + 2) { 906 m_inc(m, pkt_len + 2); 907 } 908 m->m_len = pkt_len + 2; 909 memcpy(m->m_data + 2, pkt, pkt_len); 910 911 m->m_data += 2 + ETH_HLEN; 912 m->m_len -= 2 + ETH_HLEN; 913 914 ip_input(pData, m); 915 break; 916 default: 917 break; 947 switch(proto) 948 { 949 case ETH_P_ARP: 950 arp_input(pData, pkt, pkt_len); 951 break; 952 case ETH_P_IP: 953 /* Update time. Important if the network is very quiet, as otherwise 954 * the first outgoing connection gets an incorrect timestamp. */ 955 updtime(pData); 956 957 m = m_get(pData); 958 if (!m) 959 return; 960 /* Note: we add to align the IP header */ 961 if (M_FREEROOM(m) < pkt_len + 2) 962 { 963 m_inc(m, pkt_len + 2); 964 } 965 m->m_len = pkt_len + 2; 966 memcpy(m->m_data + 2, pkt, pkt_len); 967 968 m->m_data += 2 + ETH_HLEN; 969 m->m_len -= 2 + ETH_HLEN; 970 971 ip_input(pData, m); 972 break; 973 default: 974 break; 918 975 } 919 976 } … … 940 997 struct in_addr guest_addr, int guest_port) 941 998 { 942 if (is_udp) { 999 if (is_udp) 1000 { 943 1001 if (!udp_listen(pData, htons(host_port), guest_addr.s_addr, 944 1002 htons(guest_port), 0)) 945 1003 return -1; 946 } else { 1004 } 1005 else 1006 { 947 1007 if (!solisten(pData, htons(host_port), guest_addr.s_addr, 948 1008 htons(guest_port), 0)) -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r14622 r14638 352 352 353 353 /* tcp_input.c */ 354 #ifndef VBOX_WITH_BSD_ TCP_REASS354 #ifndef VBOX_WITH_BSD_REASS 355 355 int tcp_reass _P((PNATState, register struct tcpcb *, register struct tcpiphdr *, struct mbuf *)); 356 #else /* !VBOX_WITH_BSD_ TCP_REASS */356 #else /* !VBOX_WITH_BSD_REASS */ 357 357 int tcp_reass _P((PNATState, struct tcpcb *, struct tcphdr *, int *, struct mbuf *)); 358 #endif /* VBOX_WITH_BSD_ TCP_REASS */358 #endif /* VBOX_WITH_BSD_REASS */ 359 359 void tcp_input _P((PNATState, register struct mbuf *, int, struct socket *)); 360 360 void tcp_dooptions _P((PNATState, struct tcpcb *, u_char *, int, struct tcpiphdr *)); -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r14623 r14638 105 105 struct socket *tcp_last_so; 106 106 tcp_seq tcp_iss; 107 #if ARCH_BITS == 64 107 #if ARCH_BITS == 64 && !defined(VBOX_WITH_BSD_REASS) 108 108 /* Stuff from tcp_subr.c */ 109 109 void *apvHash[16384]; … … 112 112 uint64_t cpvHashInserts; 113 113 uint64_t cpvHashDone; 114 #endif 114 #endif /* ARCH_BITS == 64 && !defined(VBOX_WITH_BSD_REASS) */ 115 115 /* Stuff from tcp_timer.c */ 116 116 struct tcpstat_t tcpstat; 117 117 uint32_t tcp_now; 118 #ifdef VBOX_WITH_BSD_ TCP_REASS118 #ifdef VBOX_WITH_BSD_REASS 119 119 int tcp_reass_qsize; 120 120 int tcp_reass_maxqlen; 121 121 int tcp_reass_maxseg; 122 122 int tcp_reass_overflows; 123 #endif /* VBOX_WITH_BSD_ TCP_REASS */123 #endif /* VBOX_WITH_BSD_REASS */ 124 124 /* Stuff from tftp.c */ 125 125 struct tftp_session tftp_sessions[TFTP_SESSIONS_MAX]; … … 246 246 #endif /* VBOX_WITH_BSD_REASS */ 247 247 248 #ifdef VBOX_WITH_BSD_ TCP_REASS248 #ifdef VBOX_WITH_BSD_REASS 249 249 #define tcp_reass_qsize pData->tcp_reass_qsize 250 250 #define tcp_reass_maxqlen pData->tcp_reass_maxqlen 251 251 #define tcp_reass_maxseg pData->tcp_reass_maxseg 252 252 #define tcp_reass_overflows pData->tcp_reass_overflows 253 #endif /* VBOX_WITH_BSD_ TCP_REASS */253 #endif /* VBOX_WITH_BSD_REASS */ 254 254 255 255 #if SIZEOF_CHAR_P != 4 -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r14616 r14638 53 53 #define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0) 54 54 55 #ifndef VBOX_WITH_BSD_ TCP_REASS55 #ifndef VBOX_WITH_BSD_REASS 56 56 /* 57 57 * Insert segment ti into reassembly queue of tcp with … … 221 221 } 222 222 223 #else /* VBOX_WITH_BSD_ TCP_REASS */223 #else /* VBOX_WITH_BSD_REASS */ 224 224 225 225 #ifndef TCP_ACK_HACK … … 400 400 return (flags); 401 401 } 402 #endif /* VBOX_WITH_BSD_ TCP_REASS */402 #endif /* VBOX_WITH_BSD_REASS */ 403 403 404 404 /* … … 723 723 } 724 724 } else if (ti->ti_ack == tp->snd_una && 725 #ifndef VBOX_WITH_BSD_ TCP_REASS725 #ifndef VBOX_WITH_BSD_REASS 726 726 u32_to_ptr(pData, tp->seg_next, struct tcpcb *) == tp && 727 #else /* VBOX_WITH_BSD_ TCP_REASS */727 #else /* VBOX_WITH_BSD_REASS */ 728 728 LIST_FIRST(&tp->t_segq) && 729 #endif /* VBOX_WITH_BSD_ TCP_REASS */729 #endif /* VBOX_WITH_BSD_REASS */ 730 730 ti->ti_len <= sbspace(&so->so_rcv)) { 731 731 /* … … 927 927 * } 928 928 */ 929 #ifndef VBOX_WITH_BSD_ TCP_REASS929 #ifndef VBOX_WITH_BSD_REASS 930 930 (void) tcp_reass(pData, tp, (struct tcpiphdr *)0, 931 931 (struct mbuf *)0); 932 #else /* VBOX_WITH_BSD_ TCP_REASS */932 #else /* VBOX_WITH_BSD_REASS */ 933 933 (void) tcp_reass(pData, tp, (struct tcphdr *)0, NULL, (struct mbuf *)0); 934 #endif /* VBOX_WITH_BSD_ TCP_REASS */934 #endif /* VBOX_WITH_BSD_REASS */ 935 935 /* 936 936 * if we didn't have to retransmit the SYN, … … 1187 1187 * } 1188 1188 */ 1189 #ifndef VBOX_WITH_BSD_ TCP_REASS1189 #ifndef VBOX_WITH_BSD_REASS 1190 1190 (void) tcp_reass(pData, tp, (struct tcpiphdr *)0, (struct mbuf *)0); 1191 #else /* VBOX_WITH_BSD_ TCP_REASS */1191 #else /* VBOX_WITH_BSD_REASS */ 1192 1192 (void) tcp_reass(pData, tp, (struct tcphdr *)0, (int *)0, (struct mbuf *)0); 1193 #endif /*VBOX_WITH_BSD_ TCP_REASS*/1193 #endif /*VBOX_WITH_BSD_REASS*/ 1194 1194 tp->snd_wl1 = ti->ti_seq - 1; 1195 1195 /* Avoid ack processing; snd_una==ti_ack => dup ack */ … … 1505 1505 if ((ti->ti_len || (tiflags&TH_FIN)) && 1506 1506 TCPS_HAVERCVDFIN(tp->t_state) == 0) { 1507 #ifndef VBOX_WITH_BSD_ TCP_REASS1507 #ifndef VBOX_WITH_BSD_REASS 1508 1508 TCP_REASS(pData, tp, ti, m, so, tiflags); 1509 #else /* VBOX_WITH_BSD_ TCP_REASS */1509 #else /* VBOX_WITH_BSD_REASS */ 1510 1510 if (ti->ti_seq == tp->rcv_nxt 1511 1511 && LIST_EMPTY(&tp->t_segq) … … 1525 1525 tiflags |= TF_ACKNOW; 1526 1526 } 1527 #endif /* VBOX_WITH_BSD_ TCP_REASS */1527 #endif /* VBOX_WITH_BSD_REASS */ 1528 1528 /* 1529 1529 * Note the amount of data that peer has sent into -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r14616 r14638 56 56 tcb.so_next = tcb.so_prev = &tcb; 57 57 tcp_last_so = &tcb; 58 #ifdef VBOX_WITH_BSD_ TCP_REASS58 #ifdef VBOX_WITH_BSD_REASS 59 59 tcp_reass_maxqlen = 48; 60 60 tcp_reass_maxseg = 256; 61 #endif /* VBOX_WITH_BSD_ TCP_REASS */61 #endif /* VBOX_WITH_BSD_REASS */ 62 62 } 63 63 … … 201 201 202 202 memset((char *) tp, 0, sizeof(struct tcpcb)); 203 #ifndef VBOX_WITH_BSD_ TCP_REASS203 #ifndef VBOX_WITH_BSD_REASS 204 204 tp->seg_next = tp->seg_prev = ptr_to_u32(pData, (struct tcpiphdr *)tp); 205 #endif /* !VBOX_WITH_BSD_ TCP_REASS */205 #endif /* !VBOX_WITH_BSD_REASS */ 206 206 tp->t_maxseg = tcp_mssdflt; 207 207 … … 274 274 register struct mbuf *m; 275 275 276 #ifndef VBOX_WITH_BSD_ TCP_REASS276 #ifndef VBOX_WITH_BSD_REASS 277 277 DEBUG_CALL("tcp_close"); 278 278 DEBUG_ARG("tp = %lx", (long )tp); … … 292 292 /* free(tp, M_PCB); */ 293 293 u32ptr_done(pData, ptr_to_u32(pData, tp), tp); 294 #else /* VBOX_WITH_BSD_ TCP_REASS */294 #else /* VBOX_WITH_BSD_REASS */ 295 295 struct tseg_qent *te; 296 296 DEBUG_CALL("tcp_close"); … … 303 303 tcp_reass_qsize--; 304 304 } 305 #endif /* VBOX_WITH_BSD_ TCP_REASS */305 #endif /* VBOX_WITH_BSD_REASS */ 306 306 free(tp); 307 307 so->so_tcpcb = 0; … … 943 943 } 944 944 945 #if SIZEOF_CHAR_P != 4 945 #if SIZEOF_CHAR_P != 4 && !defined(VBOX_WITH_BSD_REASS) 946 946 /** 947 947 * Slow pointer hashing that deals with automatic inserting and collisions. … … 1063 1063 } 1064 1064 1065 #endif 1065 #endif /* SIZEOF_CHAR_P != 4 && !defined(VBOX_WITH_BSD_REASS */ -
trunk/src/VBox/Devices/Network/slirp/tcp_var.h
r14470 r14638 38 38 #define _TCP_VAR_H_ 39 39 40 #ifdef VBOX_WITH_BSD_ TCP_REASS40 #ifdef VBOX_WITH_BSD_REASS 41 41 #include "queue.h" 42 #endif /* VBOX_WITH_BSD_ TCP_REASS */42 #endif /* VBOX_WITH_BSD_REASS */ 43 43 44 44 #include "tcpip.h" … … 55 55 # include <iprt/assert.h> 56 56 57 #if defined(VBOX_WITH_BSD_ TCP_REASS) && defined(VBOX_WITH_BSD_REASS)57 #if defined(VBOX_WITH_BSD_REASS) 58 58 # define u32ptr_done(pData, u32, ptr) do {} while (0) 59 59 # define ptr_to_u32(pData, ptr) (ptr) 60 60 # define u32_to_ptr(pData, u32, type) ((type)(u32)) 61 #else /* VBOX_WITH_BSD_REASS && VBOX_WITH_BSD_TCP_REASS */61 #else /* !VBOX_WITH_BSD_REASS */ 62 62 # define u32ptr_done(pData, u32, ptr) VBoxU32PtrDone((pData), (ptr), (u32)) 63 63 # define ptr_to_u32(pData, ptr) VBoxU32PtrHash((pData), (ptr)) 64 64 # define u32_to_ptr(pData, u32, type) ((type)VBoxU32PtrLookup((pData), (u32))) 65 #endif /* !VBOX_WITH_BSD_REASS || !VBOX_WITH_BSD_TCP_REASS*/65 #endif /* !VBOX_WITH_BSD_REASS */ 66 66 67 67 #endif 68 68 69 #ifdef VBOX_WITH_BSD_ TCP_REASS69 #ifdef VBOX_WITH_BSD_REASS 70 70 /* TCP segment queue entry */ 71 71 struct tseg_qent { … … 82 82 */ 83 83 struct tcpcb { 84 #ifndef VBOX_WITH_BSD_ TCP_REASS84 #ifndef VBOX_WITH_BSD_REASS 85 85 tcpiphdrp_32 seg_next; /* sequencing queue */ 86 86 tcpiphdrp_32 seg_prev; 87 #else /* VBOX_WITH_BSD_ TCP_REASS */87 #else /* VBOX_WITH_BSD_REASS */ 88 88 LIST_ENTRY(tcpcb) t_list; 89 89 struct tsegqe_head t_segq; /* segment reassembly queue */ 90 90 int t_segqlen; /* segment reassembly queue length */ 91 #endif /* VBOX_WITH_BSD_ TCP_REASS */91 #endif /* VBOX_WITH_BSD_REASS */ 92 92 short t_state; /* state of this connection */ 93 93 short t_timer[TCPT_NTIMERS]; /* tcp timers */ … … 176 176 }; 177 177 178 #ifdef VBOX_WITH_BSD_ TCP_REASS178 #ifdef VBOX_WITH_BSD_REASS 179 179 LIST_HEAD(tcpcbhead, tcpcb); 180 #endif /* VBOX_WITH_BSD_TCP_REASS*/180 #endif /* VBOX_WITH_BSD_REASS */ 181 181 182 182 #define sototcpcb(so) ((so)->so_tcpcb) … … 292 292 u_long tcps_socachemiss; /* tcp_last_so misses */ 293 293 u_long tcps_didnuttin; /* Times tcp_output didn't do anything XXX */ 294 #ifdef VBOX_WITH_BSD_ TCP_REASS294 #ifdef VBOX_WITH_BSD_REASS 295 295 u_long tcps_rcvmemdrop; 296 #endif /* VBOX_WITH_BSD_ TCP_REASS */296 #endif /* VBOX_WITH_BSD_REASS */ 297 297 }; 298 298
Note:
See TracChangeset
for help on using the changeset viewer.