From dcf602320ce0cfa316c990ce067317954d75edae Mon Sep 17 00:00:00 2001 From: gluker Date: Sat, 11 Nov 2023 19:02:14 +0300 Subject: [PATCH 01/13] shift-out-of-bounds fix for sta->rssi_stat.packet_map --- hal/phydm/phydm_phystatus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/phydm/phydm_phystatus.c b/hal/phydm/phydm_phystatus.c index f7addfb2..8aa79cdc 100644 --- a/hal/phydm/phydm_phystatus.c +++ b/hal/phydm/phydm_phystatus.c @@ -1710,7 +1710,7 @@ phydm_process_rssi_for_dm( } } if (sta->rssi_stat.ofdm_pkt_cnt != 64) { - i = 63; + i = 7; sta->rssi_stat.ofdm_pkt_cnt -= (u8)(((sta->rssi_stat.packet_map >> i) & BIT(0)) - 1); } sta->rssi_stat.packet_map = (sta->rssi_stat.packet_map << 1) | BIT(0); @@ -1747,7 +1747,7 @@ phydm_process_rssi_for_dm( PHYDM_DBG(dm, DBG_RSSI_MNTR, "CCK_2: (( %d ))\n", undecorated_smoothed_cck); } } - i = 63; + i = 7; sta->rssi_stat.ofdm_pkt_cnt -= (u8)((sta->rssi_stat.packet_map >> i) & BIT(0)); sta->rssi_stat.packet_map = sta->rssi_stat.packet_map << 1; } From abcf12a4d0654a84d2109c4b2d53ca775f6cf912 Mon Sep 17 00:00:00 2001 From: gluker Date: Sat, 11 Nov 2023 19:10:04 +0300 Subject: [PATCH 02/13] Update README with note for rtl8xxxu --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 452c3da7..48c28016 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ * Up to kernel v6.5+ ... And a bunch of various wifi chipsets +# Note + +Driver `rtl8xxxu` coming with newer kernels supports **monitor** mode so use it before trying this one + + # Howto build/install 1. Compile and install the driver: ``` From c5647f440a38e72c97054b949760ac14faf22b6c Mon Sep 17 00:00:00 2001 From: gluker Date: Tue, 23 Jan 2024 03:17:32 +0300 Subject: [PATCH 03/13] Build support for kernel 6.7 --- os_dep/linux/ioctl_cfg80211.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index cc804acf..3c8b604b 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4895,6 +4895,19 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, return ret; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)) +static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_ap_update *info) +{ + _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev); + + RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + + return rtw_add_beacon(adapter, info->beacon.head, + info->beacon.head_len, info->beacon.tail, + info->beacon.tail_len); +} +#else static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_beacon_data *info) { @@ -4907,6 +4920,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd return ret; } +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)) static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id) From 6089283b7273ab0d73febb4d421afd3b5ac9bb77 Mon Sep 17 00:00:00 2001 From: gluker Date: Sat, 16 Mar 2024 04:40:35 +0300 Subject: [PATCH 04/13] Build support for kernel 6.8 --- Makefile | 2 ++ os_dep/linux/usb_intf.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2aa7eef5..7900d33d 100755 --- a/Makefile +++ b/Makefile @@ -9,6 +9,8 @@ EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-address EXTRA_CFLAGS += -Wno-cast-function-type +EXTRA_CFLAGS += -Wno-missing-declarations +EXTRA_CFLAGS += -Wno-missing-prototypes #EXTRA_CFLAGS += -Wno-discarded-qualifiers EXTRA_CFLAGS += -Wno-uninitialized EXTRA_CFLAGS += -Wno-sometimes-uninitialized diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 24cf03b7..e9495cfa 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -306,7 +306,7 @@ struct rtw_usb_drv usb_drv = { .usbdrv.supports_autosuspend = 1, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)) .usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown, #else .usbdrv.driver.shutdown = rtw_dev_shutdown, From 3c563ab06fb0e88e20ddcd6fdb819e6f62bbaccc Mon Sep 17 00:00:00 2001 From: gluker Date: Wed, 20 Mar 2024 15:39:40 +0300 Subject: [PATCH 05/13] Fix array-index-out-of-bounds, issue 281 --- include/wlan_bssdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index e7ae3591..d547b652 100644 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -95,7 +95,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[1]; + UCHAR data[8]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; @@ -343,7 +343,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[1]; + UCHAR data[8]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; From da283b76f43d5c7d4484f10cc6bf6c1ad00de73d Mon Sep 17 00:00:00 2001 From: gluker Date: Thu, 21 Mar 2024 16:05:34 +0300 Subject: [PATCH 06/13] Increase array for array-index-out-of-bounds, issue 281 --- include/wlan_bssdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index d547b652..110e533b 100644 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -95,7 +95,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[8]; + UCHAR data[255]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; @@ -343,7 +343,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[8]; + UCHAR data[255]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; From 87a83d05f9a34dd8f2038c885742710bc3ce5e7c Mon Sep 17 00:00:00 2001 From: gluker Date: Thu, 21 Mar 2024 17:06:27 +0300 Subject: [PATCH 07/13] data[1] -> data[255] -> data[] for array-index-out-of-bounds as flexible array member, issue 281 --- include/wlan_bssdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index 110e533b..539efb29 100644 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -95,7 +95,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[255]; + UCHAR data[]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; @@ -343,7 +343,7 @@ typedef struct _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; UCHAR Length; - UCHAR data[255]; + UCHAR data[]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; From f16f3a5fe5a6b441326034e68a04a5269aa4f689 Mon Sep 17 00:00:00 2001 From: gluker Date: Tue, 14 May 2024 13:21:11 +0300 Subject: [PATCH 08/13] Build support for kernel 6.9 --- os_dep/linux/ioctl_cfg80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 3c8b604b..fdf2e974 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -417,7 +417,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 if (ret != _SUCCESS) goto exit; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)) + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)) cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0); From 2f1224af6732adee60ee114f8e28d0d0cbaebb23 Mon Sep 17 00:00:00 2001 From: gluker Date: Tue, 14 May 2024 13:24:34 +0300 Subject: [PATCH 09/13] Build support for kernel 6.9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48c28016..2316c2c9 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ * MESH Support * Monitor mode * Frame injection -* Up to kernel v6.5+ +* Up to kernel v6.9+ ... And a bunch of various wifi chipsets # Note From 40e3cc989c216c7c45a72685b18c2855168581e2 Mon Sep 17 00:00:00 2001 From: gluker Date: Sat, 31 Aug 2024 04:23:41 +0300 Subject: [PATCH 10/13] Fix array-index-out-of-bounds for ieee_param->u.crypt.key --- include/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ieee80211.h b/include/ieee80211.h index dd924ecd..8139572a 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -262,7 +262,7 @@ typedef struct ieee_param { u8 idx; u8 seq[8]; /* sequence counter (set: RX, get: TX) */ u16 key_len; - u8 key[0]; + u8 key[]; } crypt; #ifdef CONFIG_AP_MODE struct { From 3547f893d5e34d6410ef52a67005d09c9bf413a1 Mon Sep 17 00:00:00 2001 From: gluker Date: Sat, 31 Aug 2024 04:26:43 +0300 Subject: [PATCH 11/13] Remove warnings for empty-body + restrict --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 7900d33d..679834af 100755 --- a/Makefile +++ b/Makefile @@ -17,6 +17,9 @@ EXTRA_CFLAGS += -Wno-sometimes-uninitialized EXTRA_CFLAGS += -Wno-enum-conversion EXTRA_CFLAGS += -Wno-vla EXTRA_CFLAGS += -Wno-date-time +EXTRA_CFLAGS += -Wno-empty-body +EXTRA_CFLAGS += -Wno-restrict + GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) From 4a9e8ed554658b82ef97fab3f21dc8f5cef8fd73 Mon Sep 17 00:00:00 2001 From: gluker Date: Mon, 20 Jan 2025 22:41:07 +0300 Subject: [PATCH 12/13] Added: https://github.com/aircrack-ng/rtl8188eus/pull/309 --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 679834af..ed2a5cbb 100755 --- a/Makefile +++ b/Makefile @@ -1046,8 +1046,10 @@ EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT SUBARCH := $(shell uname -m | sed -e "s/i.86/i386/; s/ppc64le/powerpc/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/;") ARCH ?= $(SUBARCH) CROSS_COMPILE ?= +ifeq ($(strip $(KSRC)),) KVER := $(shell uname -r) KSRC := /lib/modules/$(KVER)/build +endif MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ INSTALL_PREFIX := STAGINGMODDIR := /lib/modules/$(KVER)/kernel/drivers/staging From 6db2cf6779ac716021aa91a048389065fcbd3936 Mon Sep 17 00:00:00 2001 From: gluker Date: Mon, 20 Jan 2025 23:23:50 +0300 Subject: [PATCH 13/13] Build support for kernel 6.13 --- os_dep/linux/ioctl_cfg80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index fdf2e974..d8ce9f16 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -5666,6 +5666,9 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy } static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) + , struct net_device *dev +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) , struct cfg80211_chan_def *chandef #else