From: tho Date: Wed, 9 Nov 2011 16:13:40 +0000 (+0000) Subject: Packets/80211Bundle: fixed endian-bug in Radiotap offset calculation X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c305d6b970e5952fe006270c7184b8bbb10ba2ee;p=senf.git Packets/80211Bundle: fixed endian-bug in Radiotap offset calculation git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1824 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/80211Bundle/RadiotapPacket.cc b/senf/Packets/80211Bundle/RadiotapPacket.cc index 5f51504..8f02f2c 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.cc +++ b/senf/Packets/80211Bundle/RadiotapPacket.cc @@ -95,7 +95,8 @@ prefix_ void senf::RadiotapPacketParser::buildOffsetTable(boost::uint32_t presen // radiotap.c nor we will ever dereference those pointers, we just calculate the offsets. // This works, as long as we don't support extension headers ... header.it_len = 0xFFFF; - header.it_present = presentFlags; + // Note that all data in the header is little endian! + header.it_present = htole32(presentFlags); parseOffsetTable((boost::uint8_t*)&header, header.it_len, table); } diff --git a/senf/Packets/80211Bundle/RadiotapPacket.test.cc b/senf/Packets/80211Bundle/RadiotapPacket.test.cc index 70c5128..bbf3c75 100644 --- a/senf/Packets/80211Bundle/RadiotapPacket.test.cc +++ b/senf/Packets/80211Bundle/RadiotapPacket.test.cc @@ -137,6 +137,8 @@ SENF_AUTO_UNIT_TEST(RadiotapPacket_create) BOOST_CHECK_EQUAL( p.size(), senf::RadiotapPacketParser_Header::fixed_bytes+0 ); SENF_CHECK_NO_THROW( p->init_tsft() = 81059833346uLL ); + BOOST_CHECK_EQUAL( p.size(), senf::RadiotapPacketParser_Header::fixed_bytes + + senf::RadiotapPacketParser::tsft_t::fixed_bytes ); SENF_CHECK_NO_THROW( p->init_rate() = 12u ); SENF_CHECK_NO_THROW( p->init_dbmAntennaSignal() = -61 ); SENF_CHECK_NO_THROW( p->init_dbmAntennaNoise() = -96 );