From 6fb8cbfc86fa560efa8b548592337fcb5c741510 Mon Sep 17 00:00:00 2001 From: Jean Joskin Date: Thu, 27 Feb 2014 13:34:14 +0100 Subject: [PATCH] PacketSender::send matched PDU against most specific type, hence the PDU::DOT11 case would never be chosen. --- src/packet_sender.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/packet_sender.cpp b/src/packet_sender.cpp index d829437..fb51cd8 100644 --- a/src/packet_sender.cpp +++ b/src/packet_sender.cpp @@ -238,25 +238,17 @@ void PacketSender::send(PDU &pdu) { } void PacketSender::send(PDU &pdu, const NetworkInterface &iface) { - PDU::PDUType type = pdu.pdu_type(); - switch(type) { - case PDU::ETHERNET_II: - send(pdu, iface); - break; - #ifdef HAVE_DOT11 - case PDU::DOT11: - send(pdu, iface); - break; - case PDU::RADIOTAP: - send(pdu, iface); - break; - #endif // HAVE_DOT11 - case PDU::IEEE802_3: - send(pdu, iface); - break; - default: - send(pdu); - }; + if (pdu.matches_flag(PDU::ETHERNET_II)) + send(pdu, iface); + #ifdef HAVE_DOT11 + else if (pdu.matches_flag(PDU::DOT11)) + send(pdu, iface); + else if (pdu.matches_flag(PDU::RADIOTAP)) + send(pdu, iface); + #endif // HAVE_DOT11 + else if (pdu.matches_flag(PDU::IEEE802_3)) + send(pdu, iface); + else send(pdu); } PDU *PacketSender::send_recv(PDU &pdu) {