Skip to content

Add WFP listen hook simulation for sock_addr listen testing#306

Open
mikeagun wants to merge 3 commits into
microsoft:mainfrom
mikeagun:sockops-listen-hook
Open

Add WFP listen hook simulation for sock_addr listen testing#306
mikeagun wants to merge 3 commits into
microsoft:mainfrom
mikeagun:sockops-listen-hook

Conversation

@mikeagun
Copy link
Copy Markdown

Add usersim_fwp_cgroup_inet4_listen and usersim_fwp_cgroup_inet6_listen to simulate WFP ALE_AUTH_LISTEN_V4/V6 layer classify calls. These enable unit testing of the
new cgroup/listen4 and cgroup/listen6 sock_addr attach types in ebpf-for-windows.

The functions populate FWPS_FIELD_ALE_AUTH_LISTEN_V4/V6 incoming values (local address, port, compartment ID, interface LUID, app ID) and invoke the registered WFP callout via test_callout.

Michael Agun and others added 3 commits May 13, 2026 12:51
Rename usersim listen hook test functions from sock_ops naming to
cgroup_inet naming to match the sock_addr-based listen hook design:
- usersim_fwp_sock_ops_listen_v4 -> usersim_fwp_cgroup_inet4_listen
- usersim_fwp_sock_ops_listen_v6 -> usersim_fwp_cgroup_inet6_listen
- test_sock_ops_listen_v4 -> test_cgroup_inet4_listen
- test_sock_ops_listen_v6 -> test_cgroup_inet6_listen

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/fwp_um.cpp
{
FWPS_INCOMING_VALUE0 incoming_value[FWPS_FIELD_ALE_AUTH_LISTEN_V4_MAX] = {};
incoming_value[FWPS_FIELD_ALE_AUTH_LISTEN_V4_IP_LOCAL_ADDRESS].value.uint32 = parameters->destination_ipv4_address;
incoming_value[FWPS_FIELD_ALE_AUTH_LISTEN_V4_IP_LOCAL_PORT].value.uint16 = parameters->destination_port;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we rename destination_ipv4_address and destination_port to a more accurate name, like local_ip and remote_ip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants