UDP use SIO_QUERY_WFP_CONNECTION_REDIRECT_RECORDS

ti.ti 6 Reputation points
2021-02-22T15:33:17.4+00:00

Hello, I'm developing WFP call out driver and proxy.

FWPM_LAYER_ALE_CONNECT_REDIRECT_V4 redirects UDP connections to a local proxy.
The redirect was successful, but I want to get the original remote address with the SIO_QUERY_WFP_CONNECTION_REDIRECT_RECORDS control code.
But IOCTRL gives a WSAEOPNOTSUPP error. How can I get a remote address with UDP?

this is the code.

addrinfo baseInfo = { 0 };
addrinfo* svrInfo = NULL;
baseInfo.ai_family = AF_INET;
baseInfo.ai_socktype = SOCK_DGRAM;
baseInfo.ai_protocol = IPPROTO_UDP;
baseInfo.ai_flags = AI_PASSIVE;

listenSocket = socket(svrInfo->ai_family, svrInfo->ai_socktype, svrInfo->ai_protocol);
bind(listenSocket, svrInfo->ai_addr, (int)svrInfo->ai_addrlen);
char recv_buff[512];
recvfrom(ListenSocket, recv_buff, 512 , 0, (struct sockaddr*)&sin, &len);

status = WSAIoctl(listenSocket,
SIO_QUERY_WFP_CONNECTION_REDIRECT_RECORDS,
0,
0,
pRecords,
REDIRECT_RECORDS_SIZE,
(LPDWORD)&recordsSize,
0,
// status error

thank you.

Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,625 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.