VirtualBox

Changeset 23918 in vbox


Ignore:
Timestamp:
Oct 20, 2009 5:25:29 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53723
Message:

DrvIntNet: Send dummy ethernet frame on resume after teleporting.

File:
1 edited

Legend:

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

    r23208 r23918  
    3333#include <iprt/asm.h>
    3434#include <iprt/assert.h>
    35 #include <iprt/thread.h>
     35#include <iprt/ctype.h>
     36#include <iprt/net.h>
    3637#include <iprt/semaphore.h>
    3738#include <iprt/string.h>
    3839#include <iprt/time.h>
    39 #include <iprt/ctype.h>
     40#include <iprt/thread.h>
    4041
    4142#include "../Builtins.h"
     
    632633        drvIntNetSetActive(pThis, true /* fActive */);
    633634    }
     635    if (   PDMDrvHlpVMTeleportedAndNotFullyResumedYet(pDrvIns)
     636        && pThis->pConfigIf)
     637    {
     638        /*
     639         * We've just been teleported and need to drop a hint to the switch
     640         * since we're likely to have changed to a different port.  We just
     641         * push out some ethernet frame that doesn't mean anything to anyone.
     642         * For this purpose ethertype 0x801e was chosen since it was registered
     643         * to Sun (dunno what it is/was used for though).
     644         */
     645        union
     646        {
     647            RTNETETHERHDR   Hdr;
     648            uint8_t         ab[128];
     649        } Frame;
     650        RT_ZERO(Frame);
     651        Frame.Hdr.DstMac.au16[0] = 0xffff;
     652        Frame.Hdr.DstMac.au16[1] = 0xffff;
     653        Frame.Hdr.DstMac.au16[2] = 0xffff;
     654        Frame.Hdr.EtherType      = RT_H2BE_U16(0x801e);
     655        int rc = pThis->pConfigIf->pfnGetMac(pThis->pConfigIf, &Frame.Hdr.SrcMac);
     656        if (RT_SUCCESS(rc))
     657            rc = drvIntNetSend(&pThis->INetworkConnector, &Frame, sizeof(Frame));
     658        if (RT_FAILURE(rc))
     659            LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", pDrvIns->iInstance, rc));
     660    }
    634661}
    635662
     
    792819     * Check that no-one is attached to us.
    793820     */
    794     AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
     821    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
    795822                    ("Configuration error: Not possible to attach anything to this driver!\n"),
    796823                    VERR_PDM_DRVINS_NO_ATTACH);
Note: See TracChangeset for help on using the changeset viewer.

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