kohler / click

The Click modular router: fast modular packet processing and analysis
Other
735 stars 322 forks source link

Add support for WiFi 11n #449

Open rriggio opened 4 years ago

rriggio commented 4 years ago

This patch adds support for frame injection on 802.11n Wi-Fi cards. The patch has been tested with kernel 4.4 (the current stable OpenWRT kernel) and it should work with any recent kernel.

The patch requires support for frame injection by the specific Wi-Fi driver you are using and has been tested extensively only with the ath9k. The patch will not work for VHT rates (11ac) and in general with the ath10k driver.

The radiotap parsing code is from the upstream radiotap project.

A new SetTXRateHT element has been added to allow frame injection at arbitrary MCS (0-15).

The RadiotapEncap/Decap element now supports retry chains, however, the corresponding kernel patch has not yet been merged into upstream. All chains following the first one are thus ignored. If you need the kernel patch adding support for longer retry chains please message me.

Sample script for frame injection:

RatedSource(<9999>, RATE 1, LIMIT 100) -> EtherEncap(0x06BB, 00:15:6D:84:13:5D, FF:FF:FF:FF:FF:FF) -> WifiEncap(0x00, 0:0:0:0:0:0) -> SetTXRateHT(MCS 0, TRIES 1) -> RadiotapEncap() -> Print() -> ToDevice (moni0)

This assumes that moni0 is in monitor mode on a supported driver.

Sample script for rx:

FromDevice(moni0, PROMISC false, OUTBOUND true, SNIFFER false) ->RadiotapDecap() ->FilterPhyErr() ->WifiDupeFilter() ->ToDump(/tmp/tmp.pcap, ENCAP 802_11, SNAPLEN 0)

rriggio commented 4 years ago

Checks failed due to some apt-get error which does not seem related to my patch.

tbarbette commented 4 years ago

I will fix Travis, than you can rebase ;)

tbarbette commented 4 years ago

@rriggio you can rebase now ;) (git fetch origin && git rebase origin/master)