Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
basil00 committed Oct 6, 2019
1 parent aff111e commit 091ffb3
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions sys/windivert.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ typedef struct flow_s *flow_t;
/*
* Global state.
*/
static HANDLE inject_handle_forward = NULL;
static HANDLE injectv6_handle_forward = NULL;
static HANDLE inject_handle_forward = NULL;
static HANDLE injectv6_handle_forward = NULL;
static HANDLE inject_handle_in = NULL;
static HANDLE inject_handle_out = NULL;
static HANDLE injectv6_handle_in = NULL;
Expand Down Expand Up @@ -1059,35 +1059,37 @@ extern NTSTATUS DriverEntry(IN PDRIVER_OBJECT driver_obj,
&inject_handle_forward);
if (!NT_SUCCESS(status))
{
DEBUG_ERROR("failed to create WFP forward packet injection handle", status);
DEBUG_ERROR("failed to create WFP forward packet injection handle",
status);
goto driver_entry_exit;
}
status = FwpsInjectionHandleCreate0(AF_INET6,
FWPS_INJECTION_TYPE_NETWORK | FWPS_INJECTION_TYPE_FORWARD,
&injectv6_handle_forward);
if (!NT_SUCCESS(status))
{
DEBUG_ERROR("failed to create WFP ipv6 forward packet injection handle", status);
DEBUG_ERROR("failed to create WFP ipv6 forward packet injection handle",
status);
goto driver_entry_exit;
}

status = FwpsInjectionHandleCreate0(AF_INET,
FWPS_INJECTION_TYPE_NETWORK | FWPS_INJECTION_TYPE_FORWARD,
&inject_handle_in);
if (!NT_SUCCESS(status))
{
DEBUG_ERROR("failed to create WFP inbound packet injection handle", status);
DEBUG_ERROR("failed to create WFP inbound packet injection handle",
status);
goto driver_entry_exit;
}
status = FwpsInjectionHandleCreate0(AF_INET,
FWPS_INJECTION_TYPE_NETWORK | FWPS_INJECTION_TYPE_FORWARD,
&inject_handle_out);
if (!NT_SUCCESS(status))
{
DEBUG_ERROR("failed to create WFP outbound packet injection handle", status);
DEBUG_ERROR("failed to create WFP outbound packet injection handle",
status);
goto driver_entry_exit;
}

status = FwpsInjectionHandleCreate0(AF_INET6,
FWPS_INJECTION_TYPE_NETWORK | FWPS_INJECTION_TYPE_FORWARD,
&injectv6_handle_in);
Expand Down Expand Up @@ -3758,30 +3760,36 @@ static void windivert_network_classify(context_t context,
}
if (ipv4)
{
if ( context->layer == WINDIVERT_LAYER_NETWORK_FORWARD ) {
packet_state = FwpsQueryPacketInjectionState0(inject_handle_forward, buffers,
&packet_context);
if (context->layer == WINDIVERT_LAYER_NETWORK_FORWARD)
{
packet_state = FwpsQueryPacketInjectionState0(inject_handle_forward,
buffers, &packet_context);
}
else if ( outbound ) {
packet_state = FwpsQueryPacketInjectionState0(inject_handle_out, buffers,
&packet_context);
else if (outbound)
{
packet_state = FwpsQueryPacketInjectionState0(inject_handle_out,
buffers, &packet_context);
}
else {
packet_state = FwpsQueryPacketInjectionState0(inject_handle_in, buffers,
&packet_context);
else
{
packet_state = FwpsQueryPacketInjectionState0(inject_handle_in,
buffers, &packet_context);
}
}
else
{
if ( context->layer == WINDIVERT_LAYER_NETWORK_FORWARD ) {
packet_state = FwpsQueryPacketInjectionState0(injectv6_handle_forward, buffers,
&packet_context);
if (context->layer == WINDIVERT_LAYER_NETWORK_FORWARD)
{
packet_state = FwpsQueryPacketInjectionState0(
injectv6_handle_forward, buffers, &packet_context);
}
else if ( outbound ) {
else if (outbound)
{
packet_state = FwpsQueryPacketInjectionState0(injectv6_handle_out,
buffers, &packet_context);
}
else {
else
{
packet_state = FwpsQueryPacketInjectionState0(injectv6_handle_in,
buffers, &packet_context);
}
Expand Down

0 comments on commit 091ffb3

Please sign in to comment.