POSIX PCAP: Resolve a crash on a communication error
parent
0dae7d4354
commit
e081724da6
|
|
@ -26,7 +26,6 @@ public:
|
||||||
bool isOpen();
|
bool isOpen();
|
||||||
bool close();
|
bool close();
|
||||||
private:
|
private:
|
||||||
device_errorhandler_t err;
|
|
||||||
char errbuf[PCAP_ERRBUF_SIZE] = { 0 };
|
char errbuf[PCAP_ERRBUF_SIZE] = { 0 };
|
||||||
neodevice_t& device;
|
neodevice_t& device;
|
||||||
uint8_t deviceMAC[6];
|
uint8_t deviceMAC[6];
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ bool PCAP::IsHandleValid(neodevice_handle_t handle) {
|
||||||
return (netifIndex < knownInterfaces.size());
|
return (netifIndex < knownInterfaces.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
PCAP::PCAP(device_errorhandler_t err, neodevice_t& forDevice) : err(err), device(forDevice) {
|
PCAP::PCAP(device_errorhandler_t err, neodevice_t& forDevice) : ICommunication(err), device(forDevice) {
|
||||||
if(IsHandleValid(device.handle)) {
|
if(IsHandleValid(device.handle)) {
|
||||||
interface = knownInterfaces[(device.handle >> 24) & 0xFF];
|
interface = knownInterfaces[(device.handle >> 24) & 0xFF];
|
||||||
interface.fp = nullptr; // We're going to open our own connection to the interface. This should already be nullptr but just in case.
|
interface.fp = nullptr; // We're going to open our own connection to the interface. This should already be nullptr but just in case.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue