Driver: fortcout: Simplify fort_callout_ale_log_blocked_ip_check()

This commit is contained in:
Nodir Temirkhodjaev 2023-05-09 16:18:07 +03:00
parent 397d85b59c
commit 9792352f6a

View File

@ -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); 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( 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) PFORT_CALLOUT_ALE_EXTRA cx, PFORT_CONF_REF conf_ref, FORT_CONF_FLAGS conf_flags)
{ {
if (cx->block_reason == FORT_BLOCK_REASON_UNKNOWN if (cx->block_reason == FORT_BLOCK_REASON_UNKNOWN)
|| !(conf_flags.ask_to_connect || conf_flags.log_blocked_ip)) return FALSE;
if (!(conf_flags.ask_to_connect || conf_flags.log_blocked_ip))
return FALSE; return FALSE;
const FORT_APP_FLAGS app_flags = fort_callout_ale_conf_app_flags(cx, conf_ref); 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, inline static void fort_callout_ale_log_blocked_ip(PCFORT_CALLOUT_ARG ca,