From 9792352f6a9cc79f239faa5c74046693668a8746 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Tue, 9 May 2023 16:18:07 +0300 Subject: [PATCH] Driver: fortcout: Simplify fort_callout_ale_log_blocked_ip_check() --- src/driver/fortcout.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/driver/fortcout.c b/src/driver/fortcout.c index db7fa1bb..18a04bce 100644 --- a/src/driver/fortcout.c +++ b/src/driver/fortcout.c @@ -129,19 +129,25 @@ inline static void fort_callout_ale_log_app_path(PFORT_CALLOUT_ALE_EXTRA cx, cx->real_path->Length, cx->real_path->Buffer, &cx->irp, &cx->info); } +inline static BOOL fort_callout_ale_log_blocked_ip_check_app( + FORT_CONF_FLAGS conf_flags, FORT_APP_FLAGS app_flags) +{ + return (app_flags.v == 0 || app_flags.log_blocked) + && (app_flags.alerted || !conf_flags.log_alerted_blocked_ip); +} + inline static BOOL fort_callout_ale_log_blocked_ip_check( PFORT_CALLOUT_ALE_EXTRA cx, PFORT_CONF_REF conf_ref, FORT_CONF_FLAGS conf_flags) { - if (cx->block_reason == FORT_BLOCK_REASON_UNKNOWN - || !(conf_flags.ask_to_connect || conf_flags.log_blocked_ip)) + if (cx->block_reason == FORT_BLOCK_REASON_UNKNOWN) + return FALSE; + + if (!(conf_flags.ask_to_connect || conf_flags.log_blocked_ip)) return FALSE; const FORT_APP_FLAGS app_flags = fort_callout_ale_conf_app_flags(cx, conf_ref); - if ((app_flags.v != 0 && !app_flags.log_blocked) - || (!app_flags.alerted && conf_flags.log_alerted_blocked_ip)) - return FALSE; - return TRUE; + return fort_callout_ale_log_blocked_ip_check_app(conf_flags, app_flags); } inline static void fort_callout_ale_log_blocked_ip(PCFORT_CALLOUT_ARG ca,