From 9565703f5a7a4155a0f031fd786bb93bc381c80f Mon Sep 17 00:00:00 2001 From: consti10 Date: Sun, 6 Aug 2023 11:27:18 +0200 Subject: [PATCH] optimize IEE80211 header usage, document --- src/Ieee80211Header.hpp | 13 ++++++++++--- src/WBTxRx.cpp | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Ieee80211Header.hpp b/src/Ieee80211Header.hpp index 64be0f36..e5b60d73 100644 --- a/src/Ieee80211Header.hpp +++ b/src/Ieee80211Header.hpp @@ -77,7 +77,10 @@ struct Ieee80211HeaderOpenHD{ uint8_t mac_dst_radio_port=0; // iee80211 sequence control ( 2 bytes ) - might be overridden by the driver, and or even repurposed uint16_t sequence_control=0; - // See the data layout above for more info + // ----------------------------------- DATA LAYOUT END ----------------------------------- + /** + * We use some of the available bytes for a 8 bytes "nonce" + */ void write_nonce(const uint64_t& nonce){ memcpy((uint8_t*)&mac_src_nonce_part1,(uint8_t*)&nonce,4); memcpy((uint8_t*)&mac_dst_nonce_part2,((uint8_t*)&nonce)+4,4); @@ -91,12 +94,16 @@ struct Ieee80211HeaderOpenHD{ memcpy(((uint8_t*)nonce)+4,(uint8_t*)&mac_dst_nonce_part2,4); return nonce; } - // NOTE: We write the radio port 2 times - this way we have a pretty reliable way to check if this is an openhd packet or packet from someone else + /** + * NOTE: We write the radio port 2 times - this way we have a pretty reliable way to check if this is an openhd packet or packet from someone else + */ void write_radio_port_src_dst(uint8_t radio_port){ mac_src_radio_port=radio_port; mac_dst_radio_port=radio_port; } - // NOTE: We also write the unique id 2 times - same reason like with radio port + /* + * We also write the unique id 2 times - same reason like with radio port + */ void write_unique_id_src_dst(uint8_t id){ mac_src_unique_id_part=id; mac_dst_unique_id_part=id; diff --git a/src/WBTxRx.cpp b/src/WBTxRx.cpp index f793d3fc..6a5d7ebc 100644 --- a/src/WBTxRx.cpp +++ b/src/WBTxRx.cpp @@ -361,8 +361,8 @@ void WBTxRx::on_new_packet(const uint8_t wlan_idx, const pcap_pkthdr &hdr, } { // Same for iee80211 seq nr - uint16_t iee_seq_nr=parsedPacket->ieee80211Header->getSequenceNumber(); - m_seq_nr_helper_iee80211.on_new_sequence_number(iee_seq_nr); + //uint16_t iee_seq_nr=parsedPacket->ieee80211Header->getSequenceNumber(); + //m_seq_nr_helper_iee80211.on_new_sequence_number(iee_seq_nr); //m_console->debug("IEE SEQ NR PACKET LOSS {}",m_seq_nr_helper_iee80211.get_current_loss_percent()); } // Adjustment of which card is used for injecting packets in case there are multiple RX card(s)