From 59c97a6d9f606f84b23c03c6283c8e67a01bda5f Mon Sep 17 00:00:00 2001 From: Christian B Date: Mon, 25 Jun 2018 18:30:32 +0200 Subject: [PATCH 1/5] Update README.md --- README.md | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9e3890d..dd93df6 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,9 @@ # rtl8812au -## Realtek 8812AU driver version 5.2.20 +## Realtek 8812AU driver v5.2.20 with monitor mode and packet injection -Only supports 8812AU chipset. +Only supports 8812AU chipset, not the 8814AU or the 8821AU. -Works fine with 4.15 kernel. Source now builds with no warnings or errors. - -Added (cosmeticly edited) original Realtek_Changelog.txt, this README.md and dkms.conf. - -Added device USB IDs, sorted by ID number. -Added LED control by Makefile, module parameter and dynamic /proc writing. -Added VHT extras. -Added regdb files. ### Building @@ -24,25 +16,17 @@ $ sudo make install To use dkms install: ```sh - (as root, or sudo) copy source folder contents to /usr/src/rtl8812au-5.2.20 -``` - -```sh -$ sudo dkms add -m rtl8812au -v 5.2.20 -$ sudo dkms build -m rtl8812au -v 5.2.20 -$ sudo dkms install -m rtl8812au -v 5.2.20 +$ sudo ./dkms-install.sh ``` To use dkms uninstall and remove: ```sh -$ sudo dkms remove -m rtl8812au -v 5.2.20 --all +$ sudo ./dkms-remove.sh ``` ### LED control -Thanks to @dkadioglu and others for a start on this. - #### You can now control LED behaviour statically by Makefile, for example: ```sh @@ -78,11 +62,3 @@ As others have noted, people using NetworkManager need to add this stanza to /et [device] wifi.scan-rand-mac-address=no ``` - -### Regdb files - -If needed, copy the regulatory database files in regdb/ to /lib/firmware/ - -```sh -$ sudo cp ./regdb/* /lib/firmware/ -``` From 506ee20b05bb9429926cff6af832db5af9f7713b Mon Sep 17 00:00:00 2001 From: Christian B Date: Tue, 26 Jun 2018 10:22:52 +0200 Subject: [PATCH 2/5] Update README.md --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dd93df6..c5bf331 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # rtl8812au -## Realtek 8812AU driver v5.2.20 with monitor mode and packet injection +## Realtek 8812AU driver v5.2.20 with monitor mode and frame injection -Only supports 8812AU chipset, not the 8814AU or the 8821AU. +Only supports 8812AU chipset, not the 8814AU or the 8821AU at this point. +### Changelogs and TODO +Check the "docs/" folder for more information. +Both Realtek changelog is added and our personal changelog and TODO is in there. -### Building +### Building / Installing To build and install module manually: ```sh @@ -25,6 +28,44 @@ To use dkms uninstall and remove: $ sudo ./dkms-remove.sh ``` +### Notes +Download +``` +git clone -b v5.1.5 https://github.com/aircrack-ng/rtl8812au.git +cd rtl* +``` +Package / Build dependencies (Kali) +``` +sudo apt-get install build-essential +sudo apt-get install bc +sudo apt-get install libelf-dev +sudo apt-get install linux-headers-`uname -r` +``` +For Raspberry (RPI) also +``` +sudo apt install raspberrypi-kernel-headers +``` + +### For setting monitor mode +1. Fix problematic interference in monitor mode. +``` +airmon-ng check kill +``` +You may also uncheck the box "Automatically connect to this network when it is avaiable" in nm-connection-editor. This only works if you have a saved wifi connection. + +2. Set interface down +``` +sudo ip link set wlan0 down +``` +3. Set monitor mode +``` +sudo iw dev wlan0 set type monitor +``` +4. Set interface up +``` +sudo ip link set wlan0 up +``` + ### LED control #### You can now control LED behaviour statically by Makefile, for example: @@ -56,9 +97,12 @@ $ cat /proc/net/rtl8812au/$(your interface name)/led_enable ### NetworkManager -As others have noted, people using NetworkManager need to add this stanza to /etc/NetworkManager/NetworkManager.conf - -```sh - [device] - wifi.scan-rand-mac-address=no +Newer versions of NetworkManager switches to random MAC address. Some users would prefer to use a fixed address. +Simply add these lines below ``` +[device] +wifi.scan-rand-mac-address=no +``` +at the end of file /etc/NetworkManager/NetworkManager.conf and restart NetworkManager with the command: +``` +sudo service NetworkManager restart From 9080d7d02367ccfbd22757b764ba3de988f6ada7 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 26 Jun 2018 10:41:50 +0200 Subject: [PATCH 3/5] Enable TX queue in the monitor mode --- docs/kimocoder_Changelog.txt | 4 +++- os_dep/linux/os_intfs.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/kimocoder_Changelog.txt b/docs/kimocoder_Changelog.txt index 993f431..37a8820 100644 --- a/docs/kimocoder_Changelog.txt +++ b/docs/kimocoder_Changelog.txt @@ -5,7 +5,6 @@ TODO: - Add support for namespaces (NS) - Fix count for frames in RadioTap header (add to stats) - - Enable TX queue in monitor mode - Place signal quality and per antenna rssi into radiotap header - Calculate signal quality in the monitor mode - Add channels 151 and 153 @@ -23,6 +22,9 @@ +++ And propably alot more. We'll see. + [2018.06.26] + - Enable TX queue in the monitor mode + [2018.06.25] - Fix injected frames drop - Fixed compilation on some ARM platforms diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 52ff41e..2edd23e 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -3211,7 +3211,7 @@ int _netdev_open(struct net_device *pnetdev) rtw_set_pwr_state_check_timer(pwrctrlpriv); #endif - /* rtw_netif_carrier_on(pnetdev); */ /* call this func when rtw_joinbss_event_callback return success */ + rtw_netif_carrier_on(pnetdev); /* call this func when rtw_joinbss_event_callback return success */ rtw_netif_wake_queue(pnetdev); #ifdef CONFIG_BR_EXT From 5387d10b8a6a20814bcf2030f73ba08889fc2e29 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 26 Jun 2018 10:57:18 +0200 Subject: [PATCH 4/5] Enabled more Makefile debug --- Makefile | 13 ++++++++++--- docs/kimocoder_Changelog.txt | 2 +- os_dep/linux/ioctl_cfg80211.c | 3 +++ os_dep/linux/os_intfs.c | 3 +++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 11d28b0..e61e515 100755 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) EXTRA_CFLAGS += -O1 #EXTRA_CFLAGS += -O3 -#EXTRA_CFLAGS += -Wall -#EXTRA_CFLAGS += -Wextra +EXTRA_CFLAGS += -Wall +EXTRA_CFLAGS += -Wextra #EXTRA_CFLAGS += -Werror #EXTRA_CFLAGS += -pedantic #EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes @@ -13,7 +13,13 @@ EXTRA_CFLAGS += -Wno-unused-label EXTRA_CFLAGS += -Wno-unused-parameter EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused -#EXTRA_CFLAGS += -Wno-uninitialized +EXTRA_CFLAGS += -Wno-date-time +EXTRA_CFLAGS += -Wno-misleading-indentation +EXTRA_CFLAGS += -Wno-uninitialized +# Relax some warnings from '-Wextra' so we won't get flooded with warnings +EXTRA_CFLAGS += -Wno-sign-compare +EXTRA_CFLAGS += -Wno-missing-field-initializers +EXTRA_CFLAGS += -Wno-type-limits GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) ifeq ($(GCC_VER_49),1) @@ -45,6 +51,7 @@ CONFIG_PCI_HCI = n CONFIG_SDIO_HCI = n CONFIG_GSPI_HCI = n ########################## Features ########################### +CONFIG_NET_NS = y CONFIG_MP_INCLUDED = y CONFIG_POWER_SAVING = n CONFIG_USB_AUTOSUSPEND = n diff --git a/docs/kimocoder_Changelog.txt b/docs/kimocoder_Changelog.txt index 37a8820..b5a12d7 100644 --- a/docs/kimocoder_Changelog.txt +++ b/docs/kimocoder_Changelog.txt @@ -3,7 +3,6 @@ ---------------------------------------------------------------------------------------- TODO: - - Add support for namespaces (NS) - Fix count for frames in RadioTap header (add to stats) - Place signal quality and per antenna rssi into radiotap header - Calculate signal quality in the monitor mode @@ -24,6 +23,7 @@ [2018.06.26] - Enable TX queue in the monitor mode + - Add support for namespaces (CONFIG_NET_NS) [2018.06.25] - Fix injected frames drop diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index fb033e5..daf80aa 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -7188,6 +7188,9 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) +#if defined(CONFIG_NET_NS) + wiphy->flags |= WIPHY_FLAG_NETNS_OK; +#endif //CONFIG_NET_NS wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; #endif diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 2edd23e..b20ba44 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1605,6 +1605,9 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name) rtw_init_netdev_name(ndev, name); _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); +#if defined(CONFIG_NET_NS) + dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter))); +#endif //defined(CONFIG_NET_NS) /* Tell the network stack we exist */ From f58318e310569d4a2d2f1e12d3273f9079add86f Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 26 Jun 2018 11:02:46 +0200 Subject: [PATCH 5/5] Added more VID/PID for future use --- os_dep/linux/usb_intf.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 74441c4..c07c1fe 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -220,6 +220,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { {USB_DEVICE(0x0411, 0x025D), .driver_info = RTL8821}, /* BUFFALO - WI-U3-866D */ {USB_DEVICE(0x0411, 0x029B), .driver_info = RTL8821}, /* BUFFALO - WI-U2-433DHP */ {USB_DEVICE(0x0BDA, 0xA811), .driver_info = RTL8821}, /* Comfast - CF-915AC, CF-916AC */ + {USB_DEVICE(0x056E, 0x4007), .driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */ #endif #ifdef CONFIG_RTL8192E @@ -241,13 +242,21 @@ static struct usb_device_id rtw_usb_id_tbl[] = { #endif /* CONFIG_RTL8703B */ #ifdef CONFIG_RTL8814A - {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8813), .driver_info = RTL8814A}, - {USB_DEVICE(0x2001, 0x331a), .driver_info = RTL8814A}, /* D-Link - D-Link */ - {USB_DEVICE(0x0b05, 0x1817), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ + {USB_DEVICE(0x2001, 0x331A), .driver_info = RTL8814A}, /* D-Link - D-Link */ + {USB_DEVICE(0x0B05, 0x1817), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ + {USB_DEVICE(0x0B05, 0x1852), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ + {USB_DEVICE(0x0B05, 0x1853), .driver_info = RTL8814A}, /* ASUS - ASUSTeK */ {USB_DEVICE(0x056E, 0x400B), .driver_info = RTL8814A}, /* ELECOM - ELECOM */ {USB_DEVICE(0x056E, 0x400D), .driver_info = RTL8814A}, /* ELECOM - ELECOM */ {USB_DEVICE(0x7392, 0xA834), .driver_info = RTL8814A}, /* Edimax - Edimax */ + {USB_DEVICE(0x7392, 0xA833), .driver_info = RTL8814A}, /* Edimax - AC1750 */ + {USB_DEVICE(0x0BDA, 0x8813), .driver_info = RTL8814A}, /* Edimax - EDUP Adapters */ + {USB_DEVICE(0x2357, 0x0106), .driver_info = RTL8814A}, /* TP-LINK Archer T9UH */ + {USB_DEVICE(0x20F4, 0x809A), .driver_info = RTL8814A}, /* TRENDnet - TRENDnet */ + {USB_DEVICE(0x20F4, 0x809B), .driver_info = RTL8814A}, /* TRENDnet TEW-809UB */ + {USB_DEVICE(0x0846, 0x9054), .driver_info = RTL8814A}, /* Netgear A7000 */ + {USB_DEVICE(0x0E66, 0x0026), .driver_info = RTL8814A}, /* Hawking HW17ACU 1750AC */ #endif /* CONFIG_RTL8814A */ #ifdef CONFIG_RTL8188F