VirtualBox

Changeset 52662 in vbox


Ignore:
Timestamp:
Sep 9, 2014 9:46:19 PM (10 years ago)
Author:
vboxsync
Message:

NAT: Revert previous (r95391). poll(2) behaviour is different on
different hosts and on some we will not get POLLERR on RST. Reset
during normal flow also requires draining of buffered data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r52283 r52662  
    967967        LOG_NAT_SOCK(so, TCP, &NetworkEvents, readfds, writefds, xfds);
    968968
    969         /*
    970          * It's hard to hide error condition check behind existing
    971          * macros without uglifying them further, so open-code it here
    972          * instead.
    973          */
    974         {
    975             int pollerr = 0;
    976 #if defined(RT_OS_WINDOWS)
    977             {
    978                 int bit;
    979                 for (bit = 0; bit <= FD_CLOSE_BIT; ++bit)
    980                 {
    981                     if (   NetworkEvents.lNetworkEvents & (1 << bit)
    982                         && NetworkEvents.iErrorCode[bit] != 0)
    983                     {
    984                         pollerr = NetworkEvents.iErrorCode[bit];
    985                         break;
    986                     }
    987                 }
    988             }
    989 #else
    990             if (CHECK_FD_SET(so, NetworkEvents, rderr))
    991             {
    992                 socklen_t optlen = (socklen_t)sizeof(int);
    993                 ret = getsockopt(so->s, SOL_SOCKET, SO_ERROR, &pollerr, &optlen);
    994                 if (ret < 0)
    995                     pollerr = ENETDOWN;
    996             }
    997 #endif
    998             if (pollerr)
    999             {
    1000                 if (so->so_state & SS_ISFCONNECTING)
    1001                 {
    1002                     /* "continue" tcp_input() to reject connection from guest */
    1003                     so->so_state = SS_NOFDREF;
    1004                     TCP_INPUT(pData, NULL, 0, so);
    1005                 }
    1006                 else
    1007                 {
    1008                     tcp_drop(pData, sototcpcb(so), pollerr);
    1009                 }
    1010                 ret = slirpVerifyAndFreeSocket(pData, so);
    1011                 Assert(ret == 1); /* freed */
    1012                 CONTINUE(tcp);
    1013             }
    1014         }
    1015969
    1016970        /*
     
    11161070                /* mark the socket for termination _after_ it was drained */
    11171071                so->so_close = 1;
     1072                /* No idea about Windows but on Posix, POLLHUP means that we can't send more.
     1073                 * Actually in the specific error scenario, POLLERR is set as well. */
     1074#ifndef RT_OS_WINDOWS
     1075                if (CHECK_FD_SET(so, NetworkEvents, rderr))
     1076                    sofcantsendmore(so);
     1077#endif
    11181078            }
    11191079            if (so_next->so_prev == so)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette