I wanted to send an event to my service about an attempt to enable promiscuous mode on specific interface using WFP callout at FWPS_LAYER_ALE_RESOURCE_ASSIGNMENT_V4/FWPS_LAYER_ALE_RESOURCE_ASSIGNMENT_V6 but ran into difficulties.
First of all, the MSDN docs are incorrect - FWPS_FIELDS_ALE_RESOURCE_ASSIGNMENT_V4_ (fwpsk.h) - Windows drivers | Microsoft Learn says:
FWPS_FIELD_ALE_RESOURCE_ASSIGNMENT_V4_ALE_PROMISCUOUS_MODE
The possible values are:
SIO_RCVALL
SIO_RCVALL_IGMPMCAST
SIO_RCVALL_MCAST
But to my surprise, in fact, there is a RCVALL_VALUE
in the FWPS_INCOMING_VALUES
:
//
// Values for use with SIO_RCVALL* options
//
typedef enum {
RCVALL_OFF = 0,
RCVALL_ON = 1,
RCVALL_SOCKETLEVELONLY = 2,
RCVALL_IPLEVEL = 3,
} RCVALL_VALUE, *PRCVALL_VALUE;
I haven't found a way to get a real IOCTL from FWPS_INCOMING_VALUES
.
The second problem is even worse. Promiscuous mode can be set without explicit binding to an interface using IF* IOCTLs:
#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
#define SIO_RCVALL_MCAST _WSAIOW(IOC_VENDOR,2)
#define SIO_RCVALL_IGMPMCAST _WSAIOW(IOC_VENDOR,3
#define SIO_RCVALL_MCAST_IF _WSAIOW(IOC_VENDOR,13)
#define SIO_RCVALL_IF _WSAIOW(IOC_VENDOR,14)
typedef struct {
RCVALL_VALUE Mode;
ULONG Interface;
} RCVALL_IF, *PRCVALL_IF;
Interface index is also unavailable and FWPS_FIELD_ALE_RESOURCE_ASSIGNMENT_V4_IP_LOCAL_INTERFACE
is expectedly not filled.
Moreover, before sending IF* IOCTL, the socket can also be bound to any valid local address (not necessarily corresponding to the interface index).
What can I do?