From bab4d68d3fd4edbe32b399f9a0c99e7ca6ede1d8 Mon Sep 17 00:00:00 2001 From: yagel-dev <1234yagel@gmail.com> Date: Sun, 13 Oct 2024 14:25:08 +0300 Subject: [PATCH] Optimize pcap_datalink call in BaseSniffer::next_packet with extract_raw_=true --- src/sniffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sniffer.cpp b/src/sniffer.cpp index 094f9ba8..ee9c4cb9 100644 --- a/src/sniffer.cpp +++ b/src/sniffer.cpp @@ -162,12 +162,12 @@ void sniff_loop_dot11_handler(u_char* user, const struct pcap_pkthdr* h, const u PtrPacket BaseSniffer::next_packet() { sniff_data data; - const int iface_type = pcap_datalink(handle_); pcap_handler handler = 0; if (extract_raw_) { handler = &sniff_loop_handler; } else { + const int iface_type = pcap_datalink(handle_); switch (iface_type) { case DLT_EN10MB: handler = &sniff_loop_eth_handler;