Page MenuHomeFreeBSD

wtap(4): implement monitor mode and handle radiotap
Needs ReviewPublic

Authored by enweiwu on Sep 6 2022, 2:21 PM.

Details

Summary

Below is the planned commit:

wtap(4): implement monitor mode and handle radiotap

Implement monitor mode by simply adding IEEE80211_C_MONITOR to ic->ic_cap.

To get additional informations when capturing 802.11 frames, radiotap is inserted by wtap_tx_tap() when TX and wtap_rx_tap() when RX.

There are some type faults in struct wtap_rx_radiotap_header which are mainly mistakenly store unsigned values into signed integers. I have fixed them (wtap(4)) by complying with the types defined in https://www.radiotap.org/fields/defined.

Becuase the struct wtap_rx_radiotap_header comes from ath(4), there may be another patch to fix the type faults in ath(4).
Test Plan

create two parent wlan devices wtap0, wtap1

goto tools/tools/wtap/wtap, and follow the commands below (may need the priority of super user) :

./wtap c 0
./wtap c 1
./wtap c 2

create three child wlan devices (vap)

Follow the commands below (may need the priority of super user) :

ifconfig wlan0 create wlandev wtap0 wlanmode adhoc ssid test
ifconfig wlan1 create wlandev wtap1 wlanmode adhoc ssid test
ifconfig wlan2 create wlandev wtap2 wlanmode monitor

use visibility tool to enable communications between wlan0, wlan1 and wlan2

goto tools/tools/wtap/vis_map, and follow the commands below (may need the priority of super user) :

./vis_map o
./vis_map a 0 1
./vis_map a 0 2
./vis_map a 1 0
./vis_map a 1 2
./vis_map a 2 0
./vis_map a 2 1

bring up all interfaces

ifconfig wlan0 up
ifconfig wlan1 up
ifconfig wlan2 up

perform tcpdump(1)

Perform tcpdump(1) with interface wlan2 (monitor), and check whether it can see all the packets flow between wlan0 and wlan1. And check radiotap headers also.

tcpdump -i wlan2 -y IEEE802_11_RADIO

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

enweiwu edited the test plan for this revision. (Show Details)
enweiwu edited the summary of this revision. (Show Details)
enweiwu added a reviewer: kevlo.