Extracting packet sizes and timestamps from a wireless router

I want to keep a log of each packet that passes through a wireless access point.

I'm looking for the following timestamps for each packet:

  • When a packet was queued for downlink transmission
  • When the access point started to contend on the wireless channel for the first time to transmit the packet (there can be collisions, etc. which can lead to retransmissions but I'm not interested in those timestamps)
  • When the packet was transmitted successfully on the downlink
  • When a packet was received on the uplink

and the corresponding packet sizes for each of the above 4 cases. Also, some kind of a identifier to know whether the timestamps belong to a particular packet or another packet (e.g. there can be a time when the packet was queued, when the AP started to contend and when the packet was successfully transmitted. But it's important to know that all the timestamps belong to a specific packet or different packets.)

I'm not looking for any fancy APs with the latest wireless standards. Even a simple 802.11g AP should be fine.

If anyone knows of any tools/setups/any way of getting the above information, can you please help me out. Also, if you have used these tools on a specific AP, can you please tell me the AP specifications?

I'm very new to LEDE and have no experience using it. So no idea how to get started on the above setup.

I would use Wireshark...


to get the per-packet logs from different parts of the sender-stack would require changes in the wifi driver and hostapd.
what you want is probably far outside of what is possible with default software.

wireshark will give you one view on packets traversing the kernel (no the device), but is not meant for continous and comprehensive logging.

You may want to look at softflowd, as long as you don't need a copy of the packets themselves.

Thanks for your reply. I appreciate you taking the time. But I feel that wireshark can only give me the timestamps that will be closer to the 3rd and the 4th bullet. The 1st and the 2nd bullet will still not be available in wireshark. Is this correct?

Thanks for your time. I really appreciate it.
Is this tool similar to what wireshark does? I’m thinking that it might not provide me with the 1st and the 2nd bullet.

Thanks for your reply. I appreciate you taking the time. Could you please give me a hint on what parts of the driver would require changes to get the timestamps and how difficult these changes would be to achieve. I'm new to driver modification and so don't know what are the best practices in driver modifications. Are there any online resources that could better equip me with this?

Possbibly with Monitor and radiotap

The "Make WiFi Fast" project may have something on this. You are definitely going to need to muck around in the driver itself. Make WiFi Fast concentrated on the ath9k driver. OpenWrt drivers are for the most part taken from the mainstream kernel development.

This tools captures flows (I would suggest a web search to learn more about an IP flow). I'm not even certain Wireshark does that...

I don't think softflowd will work in your case, since you want information from the hardware stack.