1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fix invalid FCS serialization offset on RadioTap

This commit is contained in:
Matias Fontanini
2016-02-02 22:43:28 -08:00
parent 8ab48106d6
commit 4b0976571e
2 changed files with 24 additions and 3 deletions

View File

@@ -9,6 +9,8 @@
#include "dot11/dot11_data.h"
#include "dot11/dot11_beacon.h"
#include "arp.h"
#include "snap.h"
#include "eapol.h"
#include "utils.h"
using namespace std;
@@ -379,4 +381,23 @@ TEST_F(RadioTapTest, TSFT) {
EXPECT_EQ(radio.tsft(), 0x7afb9a8dU);
}
TEST_F(RadioTapTest, SerializationWorksFine) {
const uint8_t expected[] = {
0, 0, 26, 0, 43, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 108,
9, 160, 0, 206, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 170, 3, 0, 0, 0, 136, 142,
1, 3, 0, 95, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 43, 4, 210
};
RadioTap radio = RadioTap() / Dot11Data() / SNAP() / RSNEAPOL();
RadioTap::serialization_type buffer = radio.serialize();
EXPECT_EQ(
RadioTap::serialization_type(expected, expected + sizeof(expected)),
buffer
);
}
#endif // HAVE_DOT11