VirtualBox

Changeset 10746 in vbox for trunk


Ignore:
Timestamp:
Jul 18, 2008 12:43:53 PM (16 years ago)
Author:
vboxsync
Message:

Added pSession argument to all the intnet request packets.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/intnet.h

    r10733 r10746  
    676676    /** The request header. */
    677677    SUPVMMR0REQHDR  Hdr;
     678    /** Alternative to passing the taking the session from the VM handle.
     679     * Either use this member or use the VM handle, don't do both. */
     680    PSUPDRVSESSION  pSession;
    678681    /** The handle to the network interface. */
    679682    INTNETIFHANDLE  hIf;
     
    692695{
    693696    /** The request header. */
    694     SUPVMMR0REQHDR          Hdr;
     697    SUPVMMR0REQHDR  Hdr;
     698    /** Alternative to passing the taking the session from the VM handle.
     699     * Either use this member or use the VM handle, don't do both. */
     700    PSUPDRVSESSION  pSession;
    695701    /** Handle to the interface. */
    696     INTNETIFHANDLE          hIf;
     702    INTNETIFHANDLE  hIf;
    697703    /** The pointer to the ring3 buffer. (output) */
    698704    R3PTRTYPE(PINTNETBUF)   pRing3Buf;
     
    712718    /** The request header. */
    713719    SUPVMMR0REQHDR  Hdr;
     720    /** Alternative to passing the taking the session from the VM handle.
     721     * Either use this member or use the VM handle, don't do both. */
     722    PSUPDRVSESSION  pSession;
    714723    /** Handle to the interface. */
    715724    INTNETIFHANDLE  hIf;
     
    731740    /** The request header. */
    732741    SUPVMMR0REQHDR  Hdr;
     742    /** Alternative to passing the taking the session from the VM handle.
     743     * Either use this member or use the VM handle, don't do both. */
     744    PSUPDRVSESSION  pSession;
    733745    /** Handle to the interface. */
    734746    INTNETIFHANDLE  hIf;
     
    748760    /** The request header. */
    749761    SUPVMMR0REQHDR  Hdr;
     762    /** Alternative to passing the taking the session from the VM handle.
     763     * Either use this member or use the VM handle, don't do both. */
     764    PSUPDRVSESSION  pSession;
    750765    /** Handle to the interface. */
    751766    INTNETIFHANDLE  hIf;
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r10663 r10746  
    237237        SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    238238        SendReq.Hdr.cbReq = sizeof(SendReq);
     239        SendReq.pSession = NULL;
    239240        SendReq.hIf = pThis->hIf;
    240241        pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
     
    248249        SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    249250        SendReq.Hdr.cbReq = sizeof(SendReq);
     251        SendReq.pSession = NULL;
    250252        SendReq.hIf = pThis->hIf;
    251253        rc = pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
     
    274276    Req.Hdr.u32Magic    = SUPVMMR0REQHDR_MAGIC;
    275277    Req.Hdr.cbReq       = sizeof(Req);
     278    Req.pSession        = NULL;
    276279    Req.hIf             = pThis->hIf;
    277280    Req.fPromiscuous    = fPromiscuous;
     
    428431        WaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    429432        WaitReq.Hdr.cbReq    = sizeof(WaitReq);
     433        WaitReq.pSession     = NULL;
    430434        WaitReq.hIf          = pThis->hIf;
    431435        WaitReq.cMillies     = 30000; /* 30s - don't wait forever, timeout now and then. */
     
    615619        CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    616620        CloseReq.Hdr.cbReq = sizeof(CloseReq);
     621        CloseReq.pSession = NULL;
    617622        CloseReq.hIf = pThis->hIf;
    618623        pThis->hIf = INTNET_HANDLE_INVALID;
     
    815820    GetRing3BufferReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    816821    GetRing3BufferReq.Hdr.cbReq = sizeof(GetRing3BufferReq);
     822    GetRing3BufferReq.pSession = NULL;
    817823    GetRing3BufferReq.hIf = pThis->hIf;
    818824    GetRing3BufferReq.pRing3Buf = NULL;
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r10724 r10746  
    662662
    663663/**
     664 * Validates a session or VM session argument.
     665 *
     666 * @returns true / false accordingly.
     667 * @param   pVM         The VM argument.
     668 * @param   pSession    The session argument.
     669 */
     670DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pSession)
     671{
     672    /* Only one out of the two */
     673    if (pVM && pSession)
     674        return false;
     675    if (pVM)
     676        pSession = pVM->pSession;
     677
     678    /** @todo supdrv should validate it. */
     679    return VALID_PTR(pSession);
     680}
     681
     682
     683/**
    664684 * VMMR0EntryEx worker function, either called directly or when ever possible
    665685 * called thru a longjmp so we can exit safely on failure.
     
    669689 * @param   enmOperation    Which operation to execute.
    670690 * @param   pReqHdr         This points to a SUPVMMR0REQHDR packet. Optional.
     691 *                          The support driver validates this if it's present.
    671692 * @param   u64Arg          Some simple constant argument.
    672693 * @remarks Assume called with interrupts _enabled_.
     
    862883        {
    863884            PINTNETOPENREQ pReq = (PINTNETOPENREQ)pReqHdr;
    864             if (u64Arg || !pReq || (pVM ? pReq->pSession != NULL : !pReq->pSession))
     885            if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession))
    865886                return VERR_INVALID_PARAMETER;
    866887            if (!g_pIntNet)
     
    870891
    871892        case VMMR0_DO_INTNET_IF_CLOSE:
    872             if (!pVM || u64Arg)
     893            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession))
    873894                return VERR_INVALID_PARAMETER;
    874895            if (!g_pIntNet)
     
    877898
    878899        case VMMR0_DO_INTNET_IF_GET_RING3_BUFFER:
    879             if (!pVM || u64Arg)
     900            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETRING3BUFFERREQ)pReqHdr)->pSession))
    880901                return VERR_INVALID_PARAMETER;
    881902            if (!g_pIntNet)
     
    884905
    885906        case VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE:
    886             if (!pVM || u64Arg)
     907            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession))
    887908                return VERR_INVALID_PARAMETER;
    888909            if (!g_pIntNet)
     
    891912
    892913        case VMMR0_DO_INTNET_IF_SEND:
    893             if (!pVM || u64Arg)
     914            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession))
    894915                return VERR_INVALID_PARAMETER;
    895916            if (!g_pIntNet)
     
    898919
    899920        case VMMR0_DO_INTNET_IF_WAIT:
    900             if (!pVM || u64Arg)
     921            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession))
    901922                return VERR_INVALID_PARAMETER;
    902923            if (!g_pIntNet)
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