Closed untyper closed 3 years ago
hi @untyper , thanks for reporting this issue! I'm not sure why this is happening, did you manage to get it working with one interface?
I have the same problem in windows 10, msvc 2017 , using the example Tutorial-LiveTraffic . I choose only one interface.
@x200502126115 if it doesn't work with one interface it's probably a different issue. Can you debug and provide more details?
I get "Error setting the capture mode for device" as well. I get it when I try to run the SSLAnalyzer example. I have previously built on Linux. Worked. Also built on WSL2 - worked as well. Have now built on Windows. Capturing with Wireshark works.
@oddaolse are you using WinPcap or Npcap? Also, which Windows version do you have?
@oddaolse @x200502126115 @untyper I'm trying to narrow down the problem, since I can't reproduce it on my machine.
Also, if someone can debug it and help finding the root cause that'd be a great help, thanks!
I'm not sure how to further debug the issue without this information so I'll close it now. Please reopen if needed
bumping this up,
It seems to be a sort of regression of npcap 1.55. I retried this using npcap 1.35, and it seems to work ok.
The error is apparently caused by a code inside of pcap_setmode(m_PcapDescriptor, MODE_CAPT)
at
if (AdapterObject->Flags == INFO_FLAG_NDIS_ADAPTER) { Result = (BOOLEAN)DeviceIoControl(AdapterObject->hFile,BIOCSMODE,&mode,4,NULL,0,&BytesReturned,NULL); }
in https://github.com/nmap/npcap/blob/master/packetWin7/Dll/Packet32.cpp
Thanks @siilky ! so I understand it only happens with newer version of Npcap? Did you try with WinPcap as well? If it's a Npcap bug, maybe you can open an issue in their repo?
So I tried the callback way to asynchronously capture packets from all devices following the example from here, but it doesn't work for some reason;
The above produces a capture device error for all devices;
But it works just fine by filling the vector asynchronously;
It also works with the blocking callback way of capturing packets. Am I missing something? Why is the async callback not working? Any ideas?
I built PcapPlusPlus from the source of the May 2021 Release using MSYS2 Mingw-w64 GCC i686-w64-mingw32 version 10.3.0 OS: Windows 10 Enterprise version 20H2 build 19042.1052
Edit: Alternatively, is there a better way to capture packets from all interfaces?