Accept IRP_MJ_WRITE when paused but silently drop the packets

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-06-19 09:38:39 +02:00
parent 7004db43a7
commit da3caadf48

View File

@ -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);