diff --git a/src/ExtTxRx.cpp b/src/ExtTxRx.cpp index 74495b65..92bb96c5 100644 --- a/src/ExtTxRx.cpp +++ b/src/ExtTxRx.cpp @@ -231,7 +231,7 @@ void ExtTxRx::on_new_packet(const uint8_t wlan_idx,const uint8_t *pkt,const int const auto& rx_iee80211_hdr_openhd = *((Ieee80211HeaderOpenHD*)pkt); const uint8_t *pkt_payload = pkt+24; - const size_t pkt_payload_size = pkt_len+28; + const size_t pkt_payload_size = pkt_len-28; m_rx_stats.count_p_any++; m_rx_stats.count_bytes_any+=pkt_payload_size; @@ -340,7 +340,9 @@ void ExtTxRx::on_new_packet(const uint8_t wlan_idx,const uint8_t *pkt,const int return; } - if (pkt_payload_size != sizeof(SessionKeyPacket)) + int sesPktSize = sizeof(SessionKeyPacket); + + if (pkt_payload_size != sesPktSize) { if(m_options.advanced_debugging_rx) { diff --git a/src/ExtTxRx.h b/src/ExtTxRx.h index 5cc6232c..b66167cc 100644 --- a/src/ExtTxRx.h +++ b/src/ExtTxRx.h @@ -247,12 +247,11 @@ class ExtTxRx { // the reasoning behind this value: https://github.com/svpcom/wifibroadcast/issues/69 static constexpr const auto PCAP_MAX_PACKET_SIZE = 1510; // This is the max number of bytes usable when injecting - static constexpr const auto RAW_WIFI_FRAME_MAX_PAYLOAD_SIZE = (PCAP_MAX_PACKET_SIZE - RadiotapHeader::SIZE_BYTES - - IEEE80211_HEADER_SIZE_BYTES); - static_assert(RAW_WIFI_FRAME_MAX_PAYLOAD_SIZE==1473); + static constexpr const auto RAW_WIFI_FRAME_MAX_PAYLOAD_SIZE = 2000; + // and we use some bytes of that for encryption / packet validation - static constexpr const auto MAX_PACKET_PAYLOAD_SIZE=RAW_WIFI_FRAME_MAX_PAYLOAD_SIZE-crypto_aead_chacha20poly1305_ABYTES; - static_assert(MAX_PACKET_PAYLOAD_SIZE==1457); + static constexpr const auto MAX_PACKET_PAYLOAD_SIZE=2000; + static std::string tx_stats_to_string(const TxStats& data); static std::string rx_stats_to_string(const RxStats& data); static std::string rx_stats_per_card_to_string(const RxStatsPerCard& data);