VirtualBox

Changeset 29464 in vbox


Ignore:
Timestamp:
May 14, 2010 11:46:15 AM (15 years ago)
Author:
vboxsync
Message:

VBoxNetFlt/win: Report stuff both when attaching to the NIC and when connecting to the internal networking. Set the trunk state to INACTIVE when connecting to the internal work or we won't report anything.

Location:
trunk/src/VBox/HostDrivers/VBoxNetFlt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c

    r29150 r29464  
    870870#ifdef VBOXNETFLT_STATIC_CONFIG
    871871    Assert(vboxNetFltGetState(pThis) == kVBoxNetFltInsState_Unconnected);
    872     /* INTNETTRUNKIFSTATE_DISCONNECTING means "not connected" here
    873      * we use the INTNETTRUNKIFSTATE_DISCONNECTING state for consistency of cases when trunk
    874      * was never connected and was connected and disconnected.
    875      * In the latter case we end up with INTNETTRUNKIFSTATE_DICONNECTING,
    876      * so use the same state for the former */
    877     Assert(pThis->enmTrunkState == INTNETTRUNKIFSTATE_DISCONNECTING);
    878872#else
    879873    Assert(vboxNetFltGetState(pThis) == kVBoxNetFltInsState_Initializing);
     874#endif
    880875    Assert(pThis->enmTrunkState == INTNETTRUNKIFSTATE_INACTIVE);
    881 #endif
    882876
    883877    /*
     
    895889        pThis->pSwitchPort = NULL;
    896890
    897 #ifdef VBOXNETFLT_STATIC_CONFIG
    898     /* INTNETTRUNKIFSTATE_DISCONNECTING means "not connected" here
    899      * we use the INTNETTRUNKIFSTATE_DISCONNECTING state for consistency of cases when trunk
    900      * was never connected and was connected and disconnected.
    901      * In the latter case we end up with INTNETTRUNKIFSTATE_DISCONNECTING,
    902      * so use the same state for the former */
    903     Assert(pThis->enmTrunkState == INTNETTRUNKIFSTATE_DISCONNECTING);
    904 #else
    905891    Assert(pThis->enmTrunkState == INTNETTRUNKIFSTATE_INACTIVE);
    906 #endif
    907892    return rc;
    908893}
     
    930915    /*
    931916     * Allocate and initialize a new instance before requesting the mutex.
     917     * Note! That in a static config we'll initialize the trunk state to
     918     *       disconnecting and flip it in vboxNetFltFactoryCreateAndConnect
     919     *       later on.  This better reflext the state and it works better with
     920     *       assertions in the destruction path.
    932921     */
    933922    int             rc;
     
    950939    pNew->enmState                      = kVBoxNetFltInsState_Initializing;
    951940#ifdef VBOXNETFLT_STATIC_CONFIG
    952     /* for consistency of cases when trunk was never connected and was connected and disconnected.
    953      * In the latter case we end up with INTNETTRUNKIFSTATE_DISCONNECTING,
    954      * so use the same state for the former */
    955941    pNew->enmTrunkState                 = INTNETTRUNKIFSTATE_DISCONNECTING;
    956942#else
     
    12051191            if (vboxNetFltGetState(pCur) == kVBoxNetFltInsState_Unconnected)
    12061192            {
     1193                pCur->enmTrunkState = INTNETTRUNKIFSTATE_INACTIVE; /** @todo protect me? */
    12071194                pCur->fDisablePromiscuous = !!(fFlags & INTNETTRUNKFACTORY_FLAG_NO_PROMISC);
    12081195                rc = vboxNetFltConnectIt(pCur, pSwitchPort, ppIfPort);
    12091196                if (RT_SUCCESS(rc))
    12101197                    pCur = NULL; /* Don't release it, reference given to the caller. */
     1198                else
     1199                    pCur->enmTrunkState = INTNETTRUNKIFSTATE_DISCONNECTING;
    12111200            }
    12121201            else
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c

    r29108 r29464  
    32173217}
    32183218
     3219
     3220/**
     3221 * Report the MAC address, promiscuous mode setting, GSO capabilities and
     3222 * no-preempt destinations to the internal network.
     3223 *
     3224 * Does nothing if we're not currently connected to an internal network.
     3225 *
     3226 * @param   pThis           The instance data.
     3227 */
     3228static void vboxNetFltWinReportStuff(PVBOXNETFLTINS pThis)
     3229{
     3230    /** @todo Keep these up to date, esp. the promiscuous mode bit. */
     3231    if (   pThis->pSwitchPort
     3232        && vboxNetFltTryRetainBusyNotDisconnected(pThis))
     3233    {
     3234        pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
     3235        pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort,
     3236                                                     vboxNetFltWinIsPromiscuous2(pThis));
     3237        pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,
     3238                                                     INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
     3239        /** @todo We should be able to do pfnXmit at DISPATCH_LEVEL... */
     3240        pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
     3241        vboxNetFltRelease(pThis, true /*fBusy*/);
     3242    }
     3243}
     3244
    32193245/**
    32203246 * Worker for vboxNetFltWinAttachToInterface.
     
    33063332
    33073333                            /* 5. Report MAC address, promiscuousness and GSO capabilities. */
    3308                             /** @todo Keep these up to date, esp. the promiscuous mode bit. */
    3309                             if (   pThis->pSwitchPort
    3310                                 && vboxNetFltTryRetainBusyNotDisconnected(pThis))
    3311                             {
    3312                                 pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
    3313                                 pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort,
    3314                                                                              vboxNetFltWinIsPromiscuous2(pThis));
    3315                                 pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,
    3316                                                                              INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
    3317                                 /** @todo We should be able to do pfnXmit at DISPATCH_LEVEL... */
    3318                                 pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
    3319                                 vboxNetFltRelease(pThis, true /*fBusy*/);
    3320                             }
     3334                            vboxNetFltWinReportStuff(pThis);
     3335
    33213336                            return;
    33223337                        }
     
    37183733    vboxNetFltWinJobSynchExecAtPassive(vboxNetFltWinConnectItWorker, &Info);
    37193734
     3735    if (RT_SUCCESS(Info.Status))
     3736        vboxNetFltWinReportStuff(pThis);
     3737
    37203738    return Info.Status;
    37213739}
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