Hi Guy,
Thanks for the clarification! I still have one question.
That might be the only way - you might have to open the device, try to get the OID in question, and, if that succeeds, assume you can set the mode, otherwise assume you can't.
pcap_create() -> pcap_can_set_rfmon() -> pcap_activate() (pcap_t is opened here)
We can see that the pcap_t has not been opened yet when calling pcap_can_set_rfmon(). I think pcap_can_set_rfmon() doesn't need to work based on an opened pcap_t on Linux. So won't change this call order in the user software level.
We have to open the adapter in libpcap/wpcap level. in libpcap, the current implementation is as below:
/*
* Check if rfmon mode is supported on the pcap_t for Windows systems.
*/
static int
pcap_can_set_rfmon_win32(pcap_t *p)
{
return (PacketIsMonitorModeSupported(p->opt.device) == 1);
}
So I think I need to open the adapter (and then close it) in this pcap_can_set_rfmon_win32() function. Is this appropriate?
Cheers,
Yang