VirtualBox

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


Ignore:
Timestamp:
Apr 23, 2010 5:25:58 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60537
Message:

SrvIntNet,VBoxNetFlt: Changing from getting to reporting (VBoxNetFlt reports stuff to SrvIntNet).

File:
1 edited

Legend:

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

    r28624 r28666  
    11271127
    11281128/**
    1129  * Lookup an address on the network, returning the (first) interface
    1130  * having it in its address cache.
     1129 * Lookup an address on the network, returning the (first) interface having it
     1130 * in its address cache.
    11311131 *
    11321132 * @returns Pointer to the interface on success, NULL if not found.  The caller
     
    42224222    AssertMsgFailed(("Not implemented because it wasn't required on Darwin\n"));
    42234223    return ASMAtomicXchgBool(&pThis->fPhysSG, fEnable);
     4224}
     4225
     4226
     4227/** @copydoc INTNETTRUNKSWPORT::pfnReportMacAddress */
     4228static DECLCALLBACK(void) intnetR0TrunkIfPortReportMacAddress(PINTNETTRUNKSWPORT pSwitchPort, PCRTMAC pMacAddr)
     4229{
     4230    PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort);
     4231
     4232    /*
     4233     * Get the network instance and grab the address spinlock before making
     4234     * any changes.
     4235     */
     4236    intnetR0BusyIncTrunk(pThis);
     4237    PINTNETNETWORK pNetwork = pThis->pNetwork;
     4238    if (pNetwork)
     4239    {
     4240        RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
     4241        RTSpinlockAcquireNoInts(pNetwork->hAddrSpinlock, &Tmp);
     4242
     4243        pNetwork->MacTab.HostMac = *pMacAddr;
     4244        pThis->MacAddr           = *pMacAddr;
     4245
     4246        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock, &Tmp);
     4247    }
     4248    else
     4249        pThis->MacAddr = *pMacAddr;
     4250    intnetR0BusyDecTrunk(pThis);
     4251}
     4252
     4253
     4254/** @copydoc INTNETTRUNKSWPORT::pfnReportPromiscuousMode */
     4255static DECLCALLBACK(void) intnetR0TrunkIfPortReportPromiscuousMode(PINTNETTRUNKSWPORT pSwitchPort, bool fPromiscuous)
     4256{
     4257    PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort);
     4258
     4259    /*
     4260     * Get the network instance and grab the address spinlock before making
     4261     * any changes.
     4262     */
     4263    intnetR0BusyIncTrunk(pThis);
     4264    PINTNETNETWORK pNetwork = pThis->pNetwork;
     4265    if (pNetwork)
     4266    {
     4267        RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
     4268        RTSpinlockAcquireNoInts(pNetwork->hAddrSpinlock, &Tmp);
     4269
     4270        pNetwork->MacTab.fHostPromiscuous = fPromiscuous;
     4271
     4272        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock, &Tmp);
     4273    }
     4274    intnetR0BusyDecTrunk(pThis);
    42244275}
    42254276
     
    46664717        pTrunk->SwitchPort.pfnSGRelease               = intnetR0TrunkIfPortSGRelease;
    46674718        pTrunk->SwitchPort.pfnSetSGPhys               = intnetR0TrunkIfPortSetSGPhys;
     4719        pTrunk->SwitchPort.pfnReportMacAddress        = intnetR0TrunkIfPortReportMacAddress;
     4720        pTrunk->SwitchPort.pfnReportPromiscuousMode   = intnetR0TrunkIfPortReportPromiscuousMode;
    46684721        pTrunk->SwitchPort.pfnReportGsoCapabilities   = intnetR0TrunkIfPortReportGsoCapabilities;
    46694722        pTrunk->SwitchPort.u32VersionEnd              = INTNETTRUNKSWPORT_VERSION;
     
    46974750        if (RT_SUCCESS(rc))
    46984751        {
     4752            /*
     4753             * There are a couple of bits in MacTab as well pertaining to the
     4754             * trunk.  We have to set this before it's reported.
     4755             *
     4756             * Note! We don't need to lock the MacTab here - creation time.
     4757             */
     4758            pNetwork->MacTab.pTrunk           = pTrunk;
     4759            pNetwork->MacTab.HostMac          = pTrunk->MacAddr;
     4760            pNetwork->MacTab.fHostPromiscuous = false;
     4761            pNetwork->MacTab.fHostActive      = true;
     4762            pNetwork->MacTab.fWirePromiscuous = false; /** @todo !!(fFlags & INTNET_OPEN_FLAGS_PROMISC_TRUNK_WIRE); */
     4763            pNetwork->MacTab.fWireActive      = true;
     4764
    46994765#ifdef IN_RING0 /* (testcase is ring-3) */
    47004766            /*
     
    47054771            if (RT_SUCCESS(rc))
    47064772            {
    4707                 rc = pTrunkFactory->pfnCreateAndConnect(pTrunkFactory, pNetwork->szTrunk, &pTrunk->SwitchPort,
     4773                rc = pTrunkFactory->pfnCreateAndConnect(pTrunkFactory,
     4774                                                        pNetwork->szTrunk,
     4775                                                        &pTrunk->SwitchPort,
    47084776                                                        pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE
    4709                                                         ? INTNETTRUNKFACTORY_FLAG_NO_PROMISC : 0,
     4777                                                        ? INTNETTRUNKFACTORY_FLAG_NO_PROMISC
     4778                                                        : 0,
    47104779                                                        &pTrunk->pIfPort);
    47114780                pTrunkFactory->pfnRelease(pTrunkFactory);
     
    47134782                {
    47144783                    Assert(pTrunk->pIfPort);
    4715                     pNetwork->MacTab.pTrunk = pTrunk;
    4716 
    4717                     /*
    4718                      * Query the host info.
    4719                      *
    4720                      * Note! We don't need to lock the MacTab here since the
    4721                      *       network is being created.
    4722                      */
    4723                     /** @todo this should be reported by VBoxNet* instead of queried by us! */
    4724                     intnetR0TrunkIfOutLock(pTrunk);
    4725 
    4726                     pTrunk->pIfPort->pfnGetMacAddress(pTrunk->pIfPort, &pTrunk->MacAddr);
    4727                     pNetwork->MacTab.HostMac          = pTrunk->MacAddr;
    4728 
    4729                     pNetwork->MacTab.fHostPromiscuous = pTrunk->pIfPort->pfnIsPromiscuous(pTrunk->pIfPort);
    4730                     pNetwork->MacTab.fHostActive      = true;
    4731 
    4732                     pNetwork->MacTab.fWirePromiscuous = false; /** @todo !!(fFlags & INTNET_OPEN_FLAGS_PROMISC_TRUNK_WIRE); */
    4733                     pNetwork->MacTab.fWireActive      = true;
    4734 
    4735                     intnetR0TrunkIfOutUnlock(pTrunk);
    47364784
    47374785                    Log(("intnetR0NetworkCreateTrunkIf: VINF_SUCCESS - pszName=%s szTrunk=%s%s Network=%s\n",
     
    47434791            rc = VERR_NOT_SUPPORTED;
    47444792#endif /* IN_RING3 */
     4793
     4794            pNetwork->MacTab.pTrunk      = NULL;
     4795            pNetwork->MacTab.fHostActive = false;
     4796            pNetwork->MacTab.fWireActive = false;
    47454797        }
    47464798
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