From 00d93c8bb72d06211e1fddde7f541d2ffb856b45 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 24 Feb 2023 20:32:27 +0300 Subject: [PATCH] Driver: fortprov: Simplify fort_prov_register_callouts(), Part 2 --- src/driver/common/fortprov.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/driver/common/fortprov.c b/src/driver/common/fortprov.c index eb1812b8..6f3dd671 100644 --- a/src/driver/common/fortprov.c +++ b/src/driver/common/fortprov.c @@ -171,7 +171,7 @@ FORT_API BOOL fort_prov_is_boot(void) return is_boot; } -static DWORD fort_prov_register_callouts(HANDLE engine) +static DWORD fort_prov_register_ale_callouts(HANDLE engine) { const FWPM_CALLOUT0 callouts[] = { /* ocallout4 */ @@ -206,6 +206,15 @@ static DWORD fort_prov_register_callouts(HANDLE engine) .providerKey = (GUID *) &FORT_GUID_PROVIDER, .applicableLayer = FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V6, }, + }; + + return fort_prov_add_callouts( + engine, callouts, /*count=*/sizeof(callouts) / sizeof(callouts[0])); +} + +static DWORD fort_prov_register_stream_callouts(HANDLE engine) +{ + const FWPM_CALLOUT0 callouts[] = { /* scallout4 */ { .calloutKey = FORT_GUID_CALLOUT_STREAM_V4, @@ -244,7 +253,7 @@ static DWORD fort_prov_register_callouts(HANDLE engine) engine, callouts, /*count=*/sizeof(callouts) / sizeof(callouts[0])); } -static DWORD fort_prov_register_packet_callouts(HANDLE engine) +static DWORD fort_prov_register_transport_callouts(HANDLE engine) { const FWPM_CALLOUT0 callouts[] = { /* itcallout4 */ @@ -359,8 +368,9 @@ static DWORD fort_prov_register_provider(HANDLE engine, BOOL is_boot) DWORD status; if ((status = FwpmProviderAdd0(engine, &provider, NULL)) || (status = FwpmSubLayerAdd0(engine, &sublayer, NULL)) - || (status = fort_prov_register_callouts(engine)) - || (status = fort_prov_register_packet_callouts(engine)) + || (status = fort_prov_register_ale_callouts(engine)) + || (status = fort_prov_register_stream_callouts(engine)) + || (status = fort_prov_register_transport_callouts(engine)) || (status = fort_prov_register_filters(engine, is_boot))) { return status; }