1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +01:00

Fixed some endianess bugs in RadioTap.

This commit is contained in:
Matias Fontanini
2011-09-06 11:44:45 -03:00
parent 0f2c73ce72
commit 69c018ce68
2 changed files with 23 additions and 4 deletions

View File

@@ -30,14 +30,16 @@
#include "utils.h"
Tins::RadioTap::RadioTap(const std::string &iface) throw (std::runtime_error) : PDU(0xff), _options_size(0) {
Tins::RadioTap::RadioTap(const std::string &iface, PDU *child) throw (std::runtime_error) : PDU(0xff, child), _options_size(0) {
if(!Utils::interface_id(iface, _iface_index))
throw std::runtime_error("Invalid interface name!");
std::memset(&_radio, 0, sizeof(_radio));
init();
}
Tins::RadioTap::RadioTap(uint32_t iface_index) : PDU(0xff), _iface_index(iface_index) {
Tins::RadioTap::RadioTap(uint32_t iface_index, PDU *child) : PDU(0xff, child), _iface_index(iface_index) {
std::memset(&_radio, 0, sizeof(_radio));
init();
}
Tins::RadioTap::RadioTap(const uint8_t *buffer, uint32_t total_sz) : PDU(0xff) {
@@ -111,6 +113,15 @@ Tins::RadioTap::RadioTap(const uint8_t *buffer, uint32_t total_sz) : PDU(0xff) {
inner_pdu(Dot11::from_bytes(buffer, total_sz));
}
void Tins::RadioTap::init() {
channel(Utils::channel_to_mhz(1), 0xa0);
flags(FCS);
tsft(0);
dbm_signal(0xce);
rx_flag(0);
antenna(0);
}
void Tins::RadioTap::version(uint8_t new_version) {
_radio.it_version = new_version;
}