SoftEtherVPN / Win10Pcap

Win10Pcap: WinPcap for Windows 10 (NDIS 6.x driver model)
Other
337 stars 122 forks source link

Win10Pcap Crash in Windows10 PC #19

Open NallasivanK opened 5 years ago

NallasivanK commented 5 years ago

I use Win10pcap component as a packet sniffer in my Windows10 PC. peridocially(say every 5 min) , I open all the NICs connected with my PC and sniff the packets and then close all the NICs.

But sometimes my exe which uses Win10Pcap crashes and all the time it points to pcap_open() call or pcap_findalldevs_ex()..i need some help on fixing this issue.

I have give below the way the above calls made.

static pcap_t OpenDevice(string nicName) { pcap_t descr = NULL; / Network interface handler / char errbuf[PCAP_ERRBUF_SIZE]; / Error buffer / memset(errbuf,0,PCAP_ERRBUF_SIZE); if ((descr = pcap_open(nicName.c_str(), 1024 /snaplen/, 0 /flags/, //PCAP_OPENFLAG_PROMISCUOUS mode is disabled 20 /read timeout/, NULL / remote authentication /, errbuf))==NULL) {
return NULL; }

 return descr;

}

static pcap_if_t FindAllDevices() {
pcap_if_t
alldevs = NULL; char errbuf[PCAP_ERRBUF_SIZE]; / Error buffer / memset(errbuf,0,PCAP_ERRBUF_SIZE); if(pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL , &alldevs, errbuf) == -1) { alldevs = NULL;
}
return alldevs; }