diff --git a/include/sniffer.h b/include/sniffer.h index 60b5c76..36f28cb 100644 --- a/include/sniffer.h +++ b/include/sniffer.h @@ -40,6 +40,7 @@ #include "ethernetII.h" #include "radiotap.h" #include "loopback.h" +#include "dot11.h" namespace Tins { /** @@ -213,6 +214,11 @@ namespace Tins { ret_val = call_functor(data, packet, header->caplen); else if(data->iface_type == DLT_IEEE802_11_RADIO) ret_val = call_functor(data, packet, header->caplen); + else if(data->iface_type == DLT_IEEE802_11) { + std::auto_ptr pdu(Tins::Dot11::from_bytes((const uint8_t*)packet, header->caplen)); + if(pdu.get()) + ret_val = data->c_handler(*pdu); + } else if(data->iface_type == DLT_NULL) ret_val = call_functor(data, packet, header->caplen); diff --git a/src/dot11.cpp b/src/dot11.cpp index 17427e1..344e901 100644 --- a/src/dot11.cpp +++ b/src/dot11.cpp @@ -1233,8 +1233,13 @@ Dot11Data::Dot11Data(const uint8_t *buffer, uint32_t total_sz) buffer += _addr4.size(); total_sz -= _addr4.size(); } - if(total_sz) - inner_pdu(new Tins::SNAP(buffer, total_sz)); + if(total_sz) { + // If the wep bit is on, then just use a RawPDU + if(wep()) + inner_pdu(new Tins::RawPDU(buffer, total_sz)); + else + inner_pdu(new Tins::SNAP(buffer, total_sz)); + } } diff --git a/src/sniffer.cpp b/src/sniffer.cpp index 793bc6f..874d9d4 100644 --- a/src/sniffer.cpp +++ b/src/sniffer.cpp @@ -73,6 +73,8 @@ PDU *BaseSniffer::next_packet() { 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); }