VirtualBox

Changeset 38111 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Jul 22, 2011 6:05:36 AM (13 years ago)
Author:
vboxsync
Message:

NAT: makes backlog value configurable in listen(, backlog).

Location:
trunk/src/VBox/Devices/Network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r37596 r38111  
    298298    STAM_PROFILE_START(&pThis->StatNATRecv, a);
    299299
    300     STAM_PROFILE_START(&pThis->StatNATRecvWait, b);
    301300
    302301    while (ASMAtomicReadU32(&pThis->cUrgPkts) != 0)
     
    312311    AssertRC(rc);
    313312
     313    STAM_PROFILE_START(&pThis->StatNATRecvWait, b);
    314314    rc = pThis->pIAboveNet->pfnWaitReceiveAvail(pThis->pIAboveNet, RT_INDEFINITE_WAIT);
     315    STAM_PROFILE_STOP(&pThis->StatNATRecvWait, b);
     316
    315317    if (RT_SUCCESS(rc))
    316318    {
     
    333335    drvNATNotifyNATThread(pThis, "drvNATRecvWorker");
    334336
    335     STAM_PROFILE_STOP(&pThis->StatNATRecvWait, b);
    336337    STAM_PROFILE_STOP(&pThis->StatNATRecv, a);
    337338}
     
    11561157                              "\0NextServer\0DNSProxy\0BindIP\0UseHostResolver\0"
    11571158                              "SlirpMTU\0AliasMode\0"
    1158                               "SockRcv\0SockSnd\0TcpRcv\0TcpSnd\0"))
     1159                              "SockRcv\0SockSnd\0TcpRcv\0TcpSnd\0"
     1160                              "SoMaxConnection\0"))
    11591161        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
    11601162                                N_("Unknown NAT configuration option, only supports PassDomain,"
     
    12131215    i32AliasMode |= (i32MainAliasMode & 0x2 ? 0x40 : 0);
    12141216    i32AliasMode |= (i32MainAliasMode & 0x4 ? 0x4 : 0);
     1217    int i32SoMaxConn = 1;
     1218    GET_S32(rc, pThis, pCfg, "SoMaxConnection", i32SoMaxConn);
    12151219    /*
    12161220     * Query the network port interface.
     
    12551259        slirp_set_dhcp_dns_proxy(pThis->pNATState, !!fDNSProxy);
    12561260        slirp_set_mtu(pThis->pNATState, MTU);
     1261        slirp_set_somaxconn(pThis->pNATState, i32SoMaxConn);
    12571262        char *pszBindIP = NULL;
    12581263        GET_STRING_ALLOC(rc, pThis, pCfg, "BindIP", pszBindIP);
  • trunk/src/VBox/Devices/Network/slirp/libslirp.h

    r35922 r38111  
    9595void slirp_set_mtu(PNATState, int);
    9696void slirp_info(PNATState pData, PCDBGFINFOHLP pHlp, const char *pszArgs);
     97void slirp_set_somaxconn(PNATState pData, int iSoMaxConn);
    9798
    9899#if defined(RT_OS_WINDOWS)
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r38110 r38111  
    606606    tcp_sndspace = 64 * _1K;
    607607    tcp_rcvspace = 64 * _1K;
     608    pData->soMaxConn = 1; /* historical value */
    608609
    609610#ifdef RT_OS_WINDOWS
     
    20022003    } while (0)
    20032004
     2005void slirp_set_somaxconn(PNATState pData, int iSoMaxConn)
     2006{
     2007    LogFlowFunc(("iSoMaxConn:d\n", iSoMaxConn));
     2008    if (iSoMaxConn > SOMAXCONN)
     2009    {
     2010        LogRel(("New value of somaxconn(%d) bigger than SOMAXCONN(%d)\n", iSoMaxConn, SOMAXCONN));
     2011        pData->soMaxConn = SOMAXCONN;
     2012    }
     2013    pData->soMaxConn = iSoMaxConn > 0 ? iSoMaxConn : pData->soMaxConn;
     2014    LogRel(("New value of somaxconn: %d\n", pData->soMaxConn));
     2015    LogFlowFuncLeave();
     2016}
    20042017/* don't allow user set less 8kB and more than 1M values */
    20052018#define _8K_1M_CHECK_ARG(name, val) CHECK_ARG(name, (val), 8, 1024)
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r36216 r38111  
    134134    int socket_rcv;
    135135    int socket_snd;
     136    int soMaxConn;
    136137#ifdef VBOX_WITH_SLIRP_MT
    137138    PRTREQQUEUE pReqQueue;
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r38108 r38111  
    10251025        || (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,(char *)&opt, sizeof(int)) < 0)
    10261026        || (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0)
    1027         || (listen(s, SOMAXCONN) < 0))
     1027        || (listen(s, pData->soMaxConn) < 0))
    10281028    {
    10291029#ifdef RT_OS_WINDOWS
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