rtl88x2BU_WiFi_linux_v5.2.4.1_22719_COEX20170518-4444.20170613 icon indicating copy to clipboard operation
rtl88x2BU_WiFi_linux_v5.2.4.1_22719_COEX20170518-4444.20170613 copied to clipboard

Whether monitor mode implemented on this driver?

Open athensy opened this issue 7 years ago • 6 comments

As title, I would like to know whether this driver support monitor mode? I try to put Wsky 1200 into monitor mode by airmon-ng (from aircrack), but it hangs up the terminal shell.

athensy avatar May 03 '18 07:05 athensy

I can confirm the bug. Running airmon-ng with the Wsky interface hangs (unkillable) airmon-ng and screws up the entire network stack making the OS unstable and making it impossible to even reboot cleanly.

Interface 15mon is too long for linux so it will be renamed to the old style (wlan#) name.


 ERROR adding monitor mode interface: command failed: Operation not supported (-95)

As a rule, most vendor drivers do not support monitor mode, but there are mentions of it in the original source here. I'll have to do some digging.

cilynx avatar May 03 '18 14:05 cilynx

Confirmed monitor mode is not supported by this driver. Need to dig more into why and how hard it would be to get it working. It's probably also worth looking into the level of effort required to bake rtl88x2bu support into the mainline rtl8xxxu effort.

rcw@burner:~$ sudo iw wl[xxxxxxxxxxxxx] set type monitor
command failed: Operation not supported (-95)
rcw@burner:~$ 

cilynx avatar May 03 '18 15:05 cilynx

If you enable CONFIG_WIFI_MONITOR and rebuild the driver, things look promising:

rcw@burner:~/Projects/rtl88x2bu$ sudo iw wl[xxxxxxxxxxxxx] set type monitor
rcw@burner:~/Projects/rtl88x2bu$ sudo iw dev
phy#3
	Interface wl[xxxxxxxxxxxxx]
		ifindex 6
		wdev 0x300000001
		addr xx:xx:xx:xx:xx:xx
		type monitor
		txpower 12.00 dBm
rcw@burner:~/Projects/rtl88x2bu$

However, while airmon-ng initially looks like it's working, it still hangs, destabilizes DNS, and forces a hard reboot to get back to a fully-functional state:

rcw@burner:~$ sudo airmon-ng start wl[xxxxxxxxxxxxx] 

PHY	Interface	Driver		Chipset

phy1	wl[xxxxxxxxxxxxx]	rtl88x2bu	Realtek Semiconductor Corp. 
Interface 15mon is too long for linux so it will be renamed to the old style (wlan#) name.

		(mac80211 monitor mode vif enabled on [phy1]wlan0mon

cilynx avatar May 03 '18 16:05 cilynx

Playing around with kismet, it fails to create a mon VIF, but successfully falls back to putting the real interface into Monitor Mode without hanging or jacking up the network stack. Unfortunately, it doesn't ever receive any packets / see any networks or clients.

I'm out of time to dig into this today. If you feel like poking around with things further, I'd be interested to hear what you find.

cilynx avatar May 03 '18 16:05 cilynx

Hi cilynx, thanks for your effort to study this issue.

I recompile the driver with CONFIG_WIFI_MONITOR flag set on, and with similar result you posted.

Then one question go through my mind: Is switching a WiFi adapter to monitor mode a generic process, or it is vendor related? i.e. It depends on hardware design. If it is vendor related, then it may be harder to implement monitor mode by outsider without detail hardware information. However, if it is not hardware dependence (or fully dependence), a "stupid" way to tackle this issue is to study source code of another WiFi dongle driver with monitor mode implemented.

I know C programming, but knowledge of Linux driver is very very thin, so I don't even have a starting point to learn a WiFi driver like this one. Could you point me a direction, or give me some hints?

athensy avatar May 04 '18 03:05 athensy

CONFIG_WIFI_MONITOR control the compiling option for program "os_dep/linux/ioctl_cfg80211.c", and affect the value "software_iftypes" of object "wiphy". Definition of "nl80211_iftype" is on lines 1719 - 1733 of this program file.

athensy avatar May 04 '18 05:05 athensy