Accept IRP_MJ_WRITE when paused but silently drop the packets
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
7004db43a7
commit
da3caadf48
9
wintun.c
9
wintun.c
@ -643,8 +643,7 @@ static NTSTATUS TunDispatchWrite(_Inout_ TUN_CTX *ctx, _Inout_ IRP *Irp)
|
||||
|
||||
KIRQL irql = ExAcquireSpinLockShared(&ctx->TransitionLock);
|
||||
LONG flags = InterlockedGet(&ctx->Flags);
|
||||
if ((status = STATUS_FILE_FORCED_CLOSED, !(flags & TUN_FLAGS_PRESENT)) ||
|
||||
(status = STATUS_CANCELLED , !(flags & TUN_FLAGS_RUNNING)))
|
||||
if (status = STATUS_FILE_FORCED_CLOSED, !(flags & TUN_FLAGS_PRESENT))
|
||||
goto cleanup_ExReleaseSpinLockShared;
|
||||
|
||||
UCHAR *buffer;
|
||||
@ -734,6 +733,12 @@ static NTSTATUS TunDispatchWrite(_Inout_ TUN_CTX *ctx, _Inout_ IRP *Irp)
|
||||
status = STATUS_SUCCESS;
|
||||
goto cleanup_ExReleaseSpinLockShared;
|
||||
}
|
||||
if (!(flags & TUN_FLAGS_RUNNING)) {
|
||||
InterlockedAdd64((LONG64 *)&ctx->Statistics.ifInDiscards, nbl_count);
|
||||
InterlockedAdd64((LONG64 *)&ctx->Statistics.ifInErrors, nbl_count);
|
||||
status = STATUS_SUCCESS;
|
||||
goto cleanup_nbl_queues;
|
||||
}
|
||||
|
||||
InterlockedAdd64(&ctx->ActiveNBLCount, nbl_count);
|
||||
InterlockedExchange(IRP_REFCOUNT(Irp), nbl_count);
|
||||
|
Loading…
Reference in New Issue
Block a user