Okay, I’m really stuck here. There was a good thread on these forums a while back ( http://www.osronline.com/showThread.CFM?link=134437 ) that helped a lot to get me started.
I’m trying to write code that can capture raw native 802.11 packets to
essentially write a packet sniffer. I’m using Vista with 802.11
device which uses an NDIS 6.0 native 802.11 driver. The reason I need to do this is because I’m writing an amateur 802.11 hardware radio using an FPGA, so I’m trying to capture all packets from an 802.11 client, including the bad packets that fail CRC, so I can do debugging on the raw bits to verify encoding and to see if and how my transmitter is distorting the bits I’m sending. I know there is stuff for linux that already does this, but I decided to try writing some windows code after seeing NDIS documentation that claimed you could do this… It’s turning out to be more tricky than it originally seemed…
Perhaps I am going about this the wrong way (and please let me know if
there are better alternatives!) I’m trying to do this all through the
Windows SDK or Windows DDK for Vista and higher.
Doing some googling and reading the documentation, it seems like the
best way to do this is run a monitoring light weight filter using the
Windows DDK. I modified the ndislwf sample to be a monitoring filter
driver and attach to “wlan” media types. I seem to be able to put the
device into monitor mode and extensible station mode via
OID_DOT11_CURRENT_OPERATION_MODE. I can also confirm that ndislwf is
attaching successfully to the NdisMediumNtive802_11 type.
The problem is my calls to set OID_GEN_CURRENT_PACKET_FILTER with
{ NDIS_PACKET_TYPE_PROMISCUOUS |NDIS_PACKET_TYPE_802_11_RAW_DATA |
NDIS_PACKET_TYPE_802_11_PROMISCUOUS_MGMT |
NDIS_PACKET_TYPE_802_11_RAW_MGMT |
NDIS_PACKET_TYPE_802_11_PROMISCUOUS_CTRL }
(as described here: http://msdn.microsoft.com/en-us/library/bb648512.aspx)
Seem to never take effect even though they return successfully from
NdisFOidRequest. According to the documentation the
DOT11_EXTSTA_RECV_CONTEXT associated with the NET_BUFFER_LIST passed
to FilterReceiveNetBufferLists should indicate
DOT11_RECV_FLAG_RAW_PACKET if these filters are set in monitor mode, but this flag is never set.
There must be something I’m doing wrong here because the microsoft documentation clearly specifies that raw packets should be flagged in this situation. I’m using a bcm42xx chipset using a native 802.11 NDIS 6.0 driver. Anyone have any ideas on this one? How can I capture the raw packets and get this flag to be indicated? I’d be happy to post my code if I can get this working…
Thanks!