VirtualBox

Changeset 30349 in vbox for trunk/src


Ignore:
Timestamp:
Jun 21, 2010 9:07:18 PM (15 years ago)
Author:
vboxsync
Message:

NAT: allow link down/link up when the VM is suspended

File:
1 edited

Legend:

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

    r30016 r30349  
    153153    /** The guest IP for port-forwarding. */
    154154    uint32_t                GuestIP;
    155     uint32_t                alignment1;
     155    /** Link state set when the VM is suspended. */
     156    PDMNETWORKLINKSTATE     enmLinkStateWant;
    156157
    157158#ifdef VBOX_WITH_SLIRP_MT
     
    594595static void drvNATNotifyLinkChangedWorker(PDRVNAT pThis, PDMNETWORKLINKSTATE enmLinkState)
    595596{
    596     pThis->enmLinkState = enmLinkState;
    597 
     597    pThis->enmLinkState = pThis->enmLinkStateWant = enmLinkState;
    598598    switch (enmLinkState)
    599599    {
     
    627627    LogFlow(("drvNATNetworkUp_NotifyLinkChanged: enmLinkState=%d\n", enmLinkState));
    628628
    629     /* don't queue new requests when the NAT thread is about to stop */
     629    /* Don't queue new requests when the NAT thread is about to stop.
     630     * But the VM could also be paused. So memorize the desired state. */
    630631    if (pThis->pSlirpThread->enmState != PDMTHREADSTATE_RUNNING)
     632    {
     633        pThis->enmLinkStateWant = enmLinkState;
    631634        return;
     635    }
    632636
    633637    PRTREQ pReq;
     
    670674    if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
    671675        return VINF_SUCCESS;
     676
     677    if (pThis->enmLinkStateWant != pThis->enmLinkState)
     678        drvNATNotifyLinkChangedWorker(pThis, pThis->enmLinkStateWant);
    672679
    673680    /*
     
    12821289#endif
    12831290
    1284             pThis->enmLinkState = PDMNETWORKLINKSTATE_UP;
     1291            pThis->enmLinkState = pThis->enmLinkStateWant = PDMNETWORKLINKSTATE_UP;
    12851292
    12861293            /* might return VINF_NAT_DNS */
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