Skip to content

Commit

Permalink
receicing
Browse files Browse the repository at this point in the history
  • Loading branch information
buldo committed Sep 10, 2023
1 parent 14271a2 commit 39ccb0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/ExtTxRx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
9 changes: 4 additions & 5 deletions src/ExtTxRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 39ccb0d

Please sign in to comment.