mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:59:38 +00:00
Driver: Check the device on asynchronous flow deletion
This commit is contained in:
parent
f42e6d8a93
commit
4d2ca84180
@ -446,6 +446,9 @@ static void NTAPI fort_callout_flow_delete(UINT16 layerId, UINT32 calloutId, UIN
|
||||
UNUSED(layerId);
|
||||
UNUSED(calloutId);
|
||||
|
||||
if (fort_device() == NULL)
|
||||
return; /* Flow is asynchronously deleting, but the Device was already removed */
|
||||
|
||||
fort_flow_delete(&fort_device()->stat, flowContext);
|
||||
}
|
||||
|
||||
@ -835,13 +838,13 @@ FORT_API NTSTATUS fort_callout_force_reauth(
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
fort_timer_update(&fort_device()->log_timer, FALSE);
|
||||
fort_timer_update(&fort_device()->log_timer, /*run=*/FALSE);
|
||||
|
||||
/* Check app group periods & update group_bits */
|
||||
{
|
||||
int periods_n = 0;
|
||||
|
||||
fort_conf_ref_period_update(&fort_device()->conf, TRUE, &periods_n);
|
||||
fort_conf_ref_period_update(&fort_device()->conf, /*force=*/TRUE, &periods_n);
|
||||
|
||||
fort_timer_update(&fort_device()->app_timer, (periods_n != 0));
|
||||
}
|
||||
@ -860,7 +863,7 @@ FORT_API NTSTATUS fort_callout_force_reauth(
|
||||
}
|
||||
|
||||
if (defer_flush_bits != 0) {
|
||||
fort_callout_defer_packet_flush(defer_flush_bits, FALSE);
|
||||
fort_callout_defer_packet_flush(defer_flush_bits, /*dispatchLevel=*/FALSE);
|
||||
}
|
||||
|
||||
/* Open provider */
|
||||
@ -875,9 +878,10 @@ FORT_API NTSTATUS fort_callout_force_reauth(
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(status)) {
|
||||
fort_timer_update(&fort_device()->log_timer,
|
||||
(conf_flags.allow_all_new || conf_flags.log_blocked || conf_flags.log_stat
|
||||
|| conf_flags.log_blocked_ip));
|
||||
const BOOL log_enabled = (conf_flags.allow_all_new || conf_flags.log_blocked
|
||||
|| conf_flags.log_stat || conf_flags.log_blocked_ip);
|
||||
|
||||
fort_timer_update(&fort_device()->log_timer, log_enabled);
|
||||
} else {
|
||||
LOG("Callout Reauth: Error: %x\n", status);
|
||||
TRACE(FORT_CALLOUT_CALLOUT_REAUTH_ERROR, status, 0, 0);
|
||||
|
@ -398,12 +398,13 @@ FORT_API void fort_device_unload()
|
||||
fort_stat_close(&fort_device()->stat);
|
||||
fort_buffer_close(&fort_device()->buffer);
|
||||
|
||||
/* Stop provider & callouts */
|
||||
/* Uninstall callouts */
|
||||
fort_callout_remove();
|
||||
|
||||
/* Unregister filters provider */
|
||||
if (!fort_device_flag(&fort_device()->conf, FORT_DEVICE_PROV_BOOT)) {
|
||||
fort_prov_unregister(NULL);
|
||||
}
|
||||
|
||||
fort_callout_remove();
|
||||
|
||||
fort_device_set(NULL);
|
||||
}
|
||||
|
@ -658,12 +658,12 @@ FORT_API void fort_pstree_open(PFORT_PSTREE ps_tree)
|
||||
|
||||
KeInitializeSpinLock(&ps_tree->lock);
|
||||
|
||||
fort_pstree_update(ps_tree, TRUE); /* Start process monitor */
|
||||
fort_pstree_update(ps_tree, /*active=*/TRUE); /* Start process monitor */
|
||||
}
|
||||
|
||||
FORT_API void fort_pstree_close(PFORT_PSTREE ps_tree)
|
||||
{
|
||||
fort_pstree_update(ps_tree, FALSE); /* Stop process monitor */
|
||||
fort_pstree_update(ps_tree, /*active=*/FALSE); /* Stop process monitor */
|
||||
|
||||
KLOCK_QUEUE_HANDLE lock_queue;
|
||||
KeAcquireInStackQueuedSpinLock(&ps_tree->lock, &lock_queue);
|
||||
|
@ -162,13 +162,15 @@ static void fort_flow_context_remove(PFORT_STAT stat, PFORT_FLOW flow)
|
||||
const BOOL isIPv6 = (flow->opt.flags & FORT_FLOW_IP6);
|
||||
|
||||
if (isIPv6) {
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_STREAM_V6, stat->stream6_id);
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_DATAGRAM_DATA_V6, stat->datagram6_id);
|
||||
if (!NT_SUCCESS(FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_STREAM_V6, stat->stream6_id))) {
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_DATAGRAM_DATA_V6, stat->datagram6_id);
|
||||
}
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_INBOUND_TRANSPORT_V6, stat->in_transport6_id);
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_OUTBOUND_TRANSPORT_V6, stat->out_transport6_id);
|
||||
} else {
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_STREAM_V4, stat->stream4_id);
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_DATAGRAM_DATA_V4, stat->datagram4_id);
|
||||
if (!NT_SUCCESS(FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_STREAM_V4, stat->stream4_id))) {
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_DATAGRAM_DATA_V4, stat->datagram4_id);
|
||||
}
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_INBOUND_TRANSPORT_V4, stat->in_transport4_id);
|
||||
FwpsFlowRemoveContext0(flow_id, FWPS_LAYER_OUTBOUND_TRANSPORT_V4, stat->out_transport4_id);
|
||||
}
|
||||
@ -260,8 +262,7 @@ static NTSTATUS fort_flow_add(PFORT_STAT stat, UINT64 flow_id, UCHAR group_index
|
||||
fort_stat_proc_inc(stat, proc_index);
|
||||
}
|
||||
|
||||
flow->opt.flags = speed_limit
|
||||
| (is_new_flow ? 0 : (flow->opt.flags & FORT_FLOW_XFLAGS))
|
||||
flow->opt.flags = speed_limit | (is_new_flow ? 0 : (flow->opt.flags & FORT_FLOW_XFLAGS))
|
||||
| (isIPv6 ? FORT_FLOW_IP6 : 0);
|
||||
flow->opt.group_index = group_index;
|
||||
flow->opt.proc_index = proc_index;
|
||||
@ -384,8 +385,8 @@ FORT_API NTSTATUS fort_flow_associate(PFORT_STAT stat, UINT64 flow_id, UINT32 pr
|
||||
if (NT_SUCCESS(status)) {
|
||||
const UCHAR speed_limit = fort_stat_group_speed_limit(stat, group_index);
|
||||
|
||||
status = fort_flow_add(stat, flow_id, group_index, proc->proc_index, speed_limit,
|
||||
isIPv6, is_tcp, is_reauth);
|
||||
status = fort_flow_add(stat, flow_id, group_index, proc->proc_index, speed_limit, isIPv6,
|
||||
is_tcp, is_reauth);
|
||||
|
||||
if (!NT_SUCCESS(status) && *is_new_proc) {
|
||||
fort_stat_proc_free(stat, proc);
|
||||
|
Loading…
Reference in New Issue
Block a user