Example #1
0
/*
 * --------------------------------------------------------------------------
 * Implements filter driver's FilterNetPnPEvent function.
 * --------------------------------------------------------------------------
 */
NDIS_STATUS
OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
                  PNET_PNP_EVENT_NOTIFICATION netPnPEvent)
{
    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
    POVS_SWITCH_CONTEXT switchContext = (POVS_SWITCH_CONTEXT)filterModuleContext;

    OVS_LOG_TRACE("Enter: filterModuleContext: %p, NetEvent: %d",
                  filterModuleContext, (netPnPEvent->NetPnPEvent).NetEvent);
    /*
     * The only interesting event is the NetEventSwitchActivate. It provides
     * an asynchronous notification of the switch completing activation.
     */
    if (netPnPEvent->NetPnPEvent.NetEvent == NetEventSwitchActivate) {
        ASSERT(switchContext->isActivated == FALSE);
        if (switchContext->isActivated == FALSE) {
            status = OvsActivateSwitch(switchContext);
            OVS_LOG_TRACE("OvsExtNetPnPEvent: activated switch: %p "
                          "status: %s", switchContext,
                          status ? "TRUE" : "FALSE");
        }
    }

    if (netPnPEvent->NetPnPEvent.NetEvent == NetEventFilterPreDetach) {
        switchContext->dataFlowState = OvsSwitchPaused;
        KeMemoryBarrier();
    }

    status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
                              netPnPEvent);
    OVS_LOG_TRACE("Exit: OvsExtNetPnPEvent");

    return status;
}
Example #2
0
//
// FilterNetPnPEvent Function
// http://msdn.microsoft.com/en-us/library/ff549952(v=vs.85).aspx
//
_Use_decl_annotations_
NDIS_STATUS
SxNdisNetPnPEvent(
    NDIS_HANDLE FilterModuleContext,
    PNET_PNP_EVENT_NOTIFICATION NetPnPEvent
    )
{
    PSX_SWITCH_OBJECT switchObject = (PSX_SWITCH_OBJECT)FilterModuleContext;
    
    if (NetPnPEvent->NetPnPEvent.NetEvent == NetEventSwitchActivate)
    {   
        //
        // Switch Activation must be passed along regardless of successful
        // initialization.
        //
        SxExtActivateSwitch(switchObject,
                            switchObject->ExtensionContext);
    }
    
    return NdisFNetPnPEvent(switchObject->NdisFilterHandle,
                            NetPnPEvent);
}
Example #3
0
/*
 * --------------------------------------------------------------------------
 * Implements filter driver's FilterNetPnPEvent function.
 * --------------------------------------------------------------------------
 */
NDIS_STATUS
OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
                  PNET_PNP_EVENT_NOTIFICATION netPnPEvent)
{
    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
    POVS_SWITCH_CONTEXT switchContext = (POVS_SWITCH_CONTEXT)filterModuleContext;
    BOOLEAN switchActive;

    OVS_LOG_TRACE("Enter: filterModuleContext: %p, NetEvent: %d",
                  filterModuleContext, (netPnPEvent->NetPnPEvent).NetEvent);
    /*
     * The only interesting event is the NetEventSwitchActivate. It provides
     * an asynchronous notification of the switch completing activation.
     */
    if (netPnPEvent->NetPnPEvent.NetEvent == NetEventSwitchActivate) {
        status = OvsQuerySwitchActivationComplete(switchContext, &switchActive);
        if (status != NDIS_STATUS_SUCCESS) {
            switchContext->isActivateFailed = TRUE;
        } else {
            ASSERT(switchContext->isActivated == FALSE);
            ASSERT(switchActive == TRUE);
            if (switchContext->isActivated == FALSE && switchActive == TRUE) {
                status = OvsActivateSwitch(switchContext);
                OVS_LOG_TRACE("OvsExtNetPnPEvent: activated switch: %p "
                              "status: %s", switchContext,
                              status ? "TRUE" : "FALSE");
            }
        }
    }

    if (status == NDIS_STATUS_SUCCESS) {
        status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
                                  netPnPEvent);
    }
    OVS_LOG_TRACE("Exit: OvsExtNetPnPEvent");

    return status;
}