Comments (7)
Can you provide an example on how you are instantiating a RadioTap object? In case you are seeing this on a pcap file, can you attach it?
It's not possible to add a pointer to the raw buffer in the PDU class because the buffer is constructed when sending the packet. There's no buffer that contains the whole packet attached to the PDU. You could call PDU::serialize which generates that buffer for you (see the docs).
from libtins.
I use find_pdu in a sniffer loop.
bool SSISampler::OnPacketRecv(const PDU& pdu)
{
if (stop_sampling) {
return false;
}
const RadioTap* tap = pdu.find_pdu<RadioTap>();
if (tap) {
const Dot11* dot11 = tap->find_pdu<Dot11>();
cout << "From: " << dot11->addr1() << ", SSI: " << (int)tap->dbm_signal() << " dBm" << endl;
if (callback) {
callback(dot11->addr1(), tap->dbm_signal());
}
}
return true;
}
The tap->dbm_signal() always returns 0.
I hacked RadioTap::RadioTap() directly to see if the packet has a SSI value.
RadioTap::RadioTap(const uint8_t *buffer, uint32_t total_sz)
{
check_size(total_sz, sizeof(_radio));
const uint8_t *buffer_start = buffer;
std::memcpy(&_radio, buffer, sizeof(_radio));
uint32_t radiotap_hdr_size = length();
check_size(total_sz, radiotap_hdr_size);
buffer += sizeof(_radio);
radiotap_hdr_size -= sizeof(_radio);
for (int i = 0; i < 0x20; i++) {
std::cout << std::hex << (int)buffer[i] << " ";
}
std::cout << std::endl;
std::cout << "SSI: " << std::dec << (int)buffer[0x16] - 256 << std::endl; // SSI is here!
if(_radio.flags.tsft)
read_field(buffer, radiotap_hdr_size, _tsft);
if(_radio.flags.flags)
read_field(buffer, radiotap_hdr_size, _flags);
....
from libtins.
If you could use tcpdump to capture at least one packet that includes a RadioTap header and attaching it here, I could fix the bug easily. Also, which platform are you running this on?
from libtins.
Test pcap file attached:
https://www.dropbox.com/s/vtlj3n80p4dtpca/cap.pcap?dl=0
I'm running it on a x86_64 intel machine.
from libtins.
Thanks for the pcap. I've found the problem. Apparently it's a completely undocumented field, the last one on the headers flags, which (and this is just based on what I see on your packets) allows the RadioTap header to be extended with another set of flag fields right after the previous one.
I don't know what's the rationale on that flag, but it completely breaks parsing because optional fields start 32 bits after they normally do. I'm working on fixing it, will let you know when it's done.
from libtins.
I've just pushed a fix. It's working on your pcap file. Could you check if it works for you please? Thanks!
from libtins.
Now it works like a charm.
Thank you very much!
from libtins.
Related Issues (20)
- I get "Anonymous types declared in an anonymous union are an extension" in icmpv6.h
- Consider using modern CMake (>=3.12) with targets
- Unable to compile Libtins for AIX
- how to call the Stream::user_data() to set and get the custom data ? HOT 1
- IPv6Address::to_string() return a local address HOT 1
- Error: live packet capture not supported on this system
- libtins.so.4.5: cannot open shared object file: No such file or directory HOT 1
- libtins 4.4 conan recipe is conan2.0 incompatible HOT 1
- Multicast packet ( specifically fieldbus) is not parsed
- Tagging a new release / fixup release with GCC 13 patch HOT 1
- 'unresolved external symbol' in Visual Studio 2022 HOT 3
- add #496 in the release notes for v4.5
- Send SYN packet failed on Windows 10 HOT 8
- Any passthru example?
- [bug] UDP::matches_response() return 0 when no inner PDU is available
- How to get gateway? HOT 1
- matches_response() implementation for EthernetII / Dot3
- DataTracker::advance_sequence removes too much data
- Seeing "android ifaddr not supported" regardless of Android version HOT 1
- failures with gtest 1.13+ HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libtins.