Skip to content

Commit

Permalink
Be more consistent with adapter and open states: not attached until t…
Browse files Browse the repository at this point in the history
…hey actually attach.
  • Loading branch information
bonsaiviking committed Sep 20, 2021
1 parent b62eba2 commit 62334cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packetWin7/npf/npf/Openclos.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,6 @@ NPF_OpenAdapter(
NPF_AddToGroupOpenArray(Open, pFiltMod);
NPF_StopUsingBinding(pFiltMod, NPF_IRQL_UNKNOWN);
}
else
{
Open->OpenStatus = OpenDetached;
}

Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = FILE_OPENED;
Expand Down Expand Up @@ -1589,6 +1585,8 @@ NPF_AddToGroupOpenArray(

NdisReleaseRWLock(pFiltMod->OpenInstancesLock, &lockState);

pOpen->OpenStatus = OpenAttached;

TRACE_EXIT();
}

Expand Down Expand Up @@ -2074,7 +2072,7 @@ NPF_CreateOpenObject(NDIS_HANDLE NdisHandle)
//
NdisAllocateSpinLock(&Open->CountersLock);

Open->OpenStatus = OpenAttached;
Open->OpenStatus = OpenDetached;

TRACE_EXIT();
return Open;
Expand Down Expand Up @@ -2108,7 +2106,7 @@ NPF_CreateFilterModule(
RtlZeroMemory(pFiltMod, sizeof(NPCAP_FILTER_MODULE));

pFiltMod->AdapterHandle = NdisFilterHandle;
pFiltMod->AdapterBindingStatus = FilterAttaching;
pFiltMod->AdapterBindingStatus = FilterStateUnspecified;
#ifdef HAVE_WFP_LOOPBACK_SUPPORT
pFiltMod->Loopback = FALSE;
#endif
Expand Down Expand Up @@ -2186,7 +2184,7 @@ NPF_CreateFilterModule(
//
// set the proper binding flags before trying to open the MAC
//
pFiltMod->AdapterBindingStatus = FilterRunning;
pFiltMod->AdapterBindingStatus = FilterInitialized;
pFiltMod->AdapterHandleUsageCounter = 0;
NdisAllocateSpinLock(&pFiltMod->AdapterHandleLock);

Expand Down
1 change: 1 addition & 0 deletions packetWin7/npf/npf/Packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ DriverEntry(
break;
}
pFiltMod->Loopback = TRUE;
pFiltMod->AdapterBindingStatus = FilterRunning;
pFiltMod->MaxFrameSize = NPF_LOOPBACK_INTERFACR_MTU + ETHER_HDR_LEN;

// No need to mess with SendToRx/BlockRx, packet filters, NDIS filter characteristics, Dot11, etc.
Expand Down

0 comments on commit 62334cf

Please sign in to comment.