mirror of
https://github.com/mfontanini/libtins
synced 2026-01-25 11:41:35 +01:00
Dot11 now uses option_not_found. Sniffer catches malformed_packet rather than std::runtime_error while sniffing.
This commit is contained in:
@@ -87,16 +87,19 @@ PtrPacket BaseSniffer::next_packet() {
|
||||
const u_char *content = pcap_next(handle, &header);
|
||||
// timestamp_ = header.ts;
|
||||
if(content) {
|
||||
if(iface_type == DLT_EN10MB)
|
||||
ret = new EthernetII((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_IEEE802_11_RADIO)
|
||||
ret = new RadioTap((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_IEEE802_11)
|
||||
ret = Dot11::from_bytes((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_LOOP)
|
||||
ret = new Tins::Loopback((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_LINUX_SLL)
|
||||
ret = new Tins::SLL((const uint8_t*)content, header.caplen);
|
||||
try {
|
||||
if(iface_type == DLT_EN10MB)
|
||||
ret = new EthernetII((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_IEEE802_11_RADIO)
|
||||
ret = new RadioTap((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_IEEE802_11)
|
||||
ret = Dot11::from_bytes((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_LOOP)
|
||||
ret = new Tins::Loopback((const uint8_t*)content, header.caplen);
|
||||
else if(iface_type == DLT_LINUX_SLL)
|
||||
ret = new Tins::SLL((const uint8_t*)content, header.caplen);
|
||||
}
|
||||
catch(malformed_packet&) {}
|
||||
}
|
||||
return PtrPacket(ret, header.ts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user