VirtualBox

Changeset 10762 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 19, 2008 12:13:03 AM (16 years ago)
Author:
vboxsync
Message:

Temporary hack for configuring HIF via the internal network name (call the network 'if=en0').

File:
1 edited

Legend:

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

    r10746 r10762  
    3838#include <iprt/string.h>
    3939#include <iprt/time.h>
     40#ifdef RT_OS_DARWIN
     41# include <iprt/ctype.h>
     42#endif
    4043
    4144#include "Builtins.h"
     
    237240        SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    238241        SendReq.Hdr.cbReq = sizeof(SendReq);
    239         SendReq.pSession = NULL;
     242        SendReq.pSession = NIL_RTR0PTR;
    240243        SendReq.hIf = pThis->hIf;
    241244        pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
     
    249252        SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    250253        SendReq.Hdr.cbReq = sizeof(SendReq);
    251         SendReq.pSession = NULL;
     254        SendReq.pSession = NIL_RTR0PTR;
    252255        SendReq.hIf = pThis->hIf;
    253256        rc = pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
     
    276279    Req.Hdr.u32Magic    = SUPVMMR0REQHDR_MAGIC;
    277280    Req.Hdr.cbReq       = sizeof(Req);
    278     Req.pSession        = NULL;
     281    Req.pSession        = NIL_RTR0PTR;
    279282    Req.hIf             = pThis->hIf;
    280283    Req.fPromiscuous    = fPromiscuous;
     
    431434        WaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    432435        WaitReq.Hdr.cbReq    = sizeof(WaitReq);
    433         WaitReq.pSession     = NULL;
     436        WaitReq.pSession     = NIL_RTR0PTR;
    434437        WaitReq.hIf          = pThis->hIf;
    435438        WaitReq.cMillies     = 30000; /* 30s - don't wait forever, timeout now and then. */
     
    619622        CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    620623        CloseReq.Hdr.cbReq = sizeof(CloseReq);
    621         CloseReq.pSession = NULL;
     624        CloseReq.pSession = NIL_RTR0PTR;
    622625        CloseReq.hIf = pThis->hIf;
    623626        pThis->hIf = INTNET_HANDLE_INVALID;
     
    709712    OpenReq.Hdr.cbReq = sizeof(OpenReq);
    710713    OpenReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    711     OpenReq.pSession = NULL;
     714    OpenReq.pSession = NIL_RTR0PTR;
    712715
    713716    /** @cfgm{Network, string}
     
    755758    OpenReq.fFlags = fRestrictAccess ? 0 : INTNET_OPEN_FLAGS_PUBLIC;
    756759
    757     /** @cfgm{ReceiveBufferSize, uint32_t, 256 KB}
     760    /** @cfgm{ReceiveBufferSize, uint32_t, 234 KB}
    758761     * The size of the receive buffer.
    759762     */
    760763    rc = CFGMR3QueryU32(pCfgHandle, "ReceiveBufferSize", &OpenReq.cbRecv);
    761764    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    762         OpenReq.cbRecv = _256K;
     765        OpenReq.cbRecv = 234 * _1K ;
    763766    else if (VBOX_FAILURE(rc))
    764767        return PDMDRV_SET_ERROR(pDrvIns, rc,
    765768                                N_("Configuration error: Failed to get the \"ReceiveBufferSize\" value"));
    766769
    767     /** @cfgm{SendBufferSize, uint32_t, 4 KB}
     770    /** @cfgm{SendBufferSize, uint32_t, 17 KB}
    768771     * The size of the send (transmit) buffer.
    769772     */
    770773    rc = CFGMR3QueryU32(pCfgHandle, "SendBufferSize", &OpenReq.cbSend);
    771774    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    772         OpenReq.cbSend = _4K;
     775        OpenReq.cbSend = 17*_1K;
    773776    else if (VBOX_FAILURE(rc))
    774777        return PDMDRV_SET_ERROR(pDrvIns, rc,
    775778                                N_("Configuration error: Failed to get the \"SendBufferSize\" value"));
    776     if (OpenReq.cbSend < 16)
     779    if (OpenReq.cbSend < 32)
    777780        return PDMDRV_SET_ERROR(pDrvIns, rc,
    778781                                N_("Configuration error: The \"SendBufferSize\" value is too small"));
    779     if (OpenReq.cbSend < 1536*2 + 4)
    780         LogRel(("DrvIntNet: Warning! SendBufferSize=%u, Recommended minimum size %u butes.\n", OpenReq.cbSend, 1536*2 + 4));
     782    if (OpenReq.cbSend < 1536*2 + 64)
     783        LogRel(("DrvIntNet: Warning! SendBufferSize=%u, Recommended minimum size %u butes.\n", OpenReq.cbSend, 1536*2 + 64));
    781784
    782785    /** @cfgm{IsService, boolean, true}
     
    794797            pDrvIns->iInstance, OpenReq.szNetwork, OpenReq.enmTrunkType, OpenReq.szTrunk, OpenReq.fFlags,
    795798            OpenReq.cbRecv, OpenReq.cbSend));
     799
     800#ifdef RT_OS_DARWIN
     801    /* Temporary hack: attach to a network with the name 'if=en0' and you're hitting the wire. */
     802    if (    !OpenReq.szTrunk[0]
     803        &&   OpenReq.enmTrunkType == kIntNetTrunkType_None
     804        &&  !strncmp(pThis->szNetwork, "if=en", sizeof("if=en") - 1)
     805        &&  RT_C_IS_DIGIT(pThis->szNetwork[sizeof("if=en") - 1])
     806        &&  !pThis->szNetwork[sizeof("if=en")])
     807    {
     808        OpenReq.enmTrunkType = kIntNetTrunkType_NetFlt;
     809        strcpy(OpenReq.szTrunk, &pThis->szNetwork[sizeof("if=") - 1]);
     810    }
     811#endif
    796812
    797813    /*
     
    820836    GetRing3BufferReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    821837    GetRing3BufferReq.Hdr.cbReq = sizeof(GetRing3BufferReq);
    822     GetRing3BufferReq.pSession = NULL;
     838    GetRing3BufferReq.pSession = NIL_RTR0PTR;
    823839    GetRing3BufferReq.hIf = pThis->hIf;
    824840    GetRing3BufferReq.pRing3Buf = NULL;
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