From 27af5add83088af64b013ec99db1ddf824112e6e Mon Sep 17 00:00:00 2001 From: Shen Mintao Date: Thu, 17 Sep 2026 13:55:56 +0800 Subject: [PATCH] fix: support OpenWrt cfg80211 backport versions Allow CFG80211_VERSION to select wireless API signatures independently of the target kernel. Keep native kernel builds on their existing version checks. Also guard the WEXT-only label and replace overlapping firmware path formatting with bounded appends so OpenWrt builds pass with Werror. Validated all three modules against OpenWrt Linux 6.12.94 with backports 6.18.26, plus native 6.11, 6.17 and 7.2 headers. Refs #94. --- drivers/aic8800/aic8800_fdrv/Makefile | 10 +++ drivers/aic8800/aic8800_fdrv/aic_priv_cmd.c | 8 +-- drivers/aic8800/aic8800_fdrv/aic_priv_cmd.h | 2 +- .../aic8800_fdrv/aicwf_compat_8800d80.c | 3 +- .../aic8800_fdrv/aicwf_compat_8800d80x2.c | 3 +- drivers/aic8800/aic8800_fdrv/rwnx_compat.h | 5 ++ drivers/aic8800/aic8800_fdrv/rwnx_main.c | 66 +++++++++---------- drivers/aic8800/aic8800_fdrv/rwnx_main.h | 2 +- drivers/aic8800/aic8800_fdrv/rwnx_msg_rx.c | 2 + drivers/aic8800/aic8800_fdrv/rwnx_platform.c | 9 ++- drivers/aic8800/aic8800_fdrv/rwnx_radar.c | 4 +- drivers/aic8800/aic8800_fdrv/rwnx_rx.c | 4 +- drivers/aic8800/aic8800_fdrv/rwnx_tdls.c | 2 +- 13 files changed, 71 insertions(+), 49 deletions(-) diff --git a/drivers/aic8800/aic8800_fdrv/Makefile b/drivers/aic8800/aic8800_fdrv/Makefile index 6a80ac9..b2a3514 100644 --- a/drivers/aic8800/aic8800_fdrv/Makefile +++ b/drivers/aic8800/aic8800_fdrv/Makefile @@ -2,6 +2,16 @@ EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) EXTRA_CFLAGS += -Wno-implicit-fallthrough #EXTRA_CFLAGS += -Wno-unused-variable +# OpenWrt may build a newer cfg80211 backport on an older kernel. +# Set this to the wireless stack's version, e.g. CFG80211_VERSION=6.18.26. +ifneq ($(strip $(CFG80211_VERSION)),) +aicwf_cfg80211_version := $(subst ., ,$(CFG80211_VERSION)) +ifneq ($(words $(aicwf_cfg80211_version)),3) +$(error CFG80211_VERSION must have the form major.minor.patch) +endif +ccflags-y += '-DAICWF_CFG80211_VERSION_CODE=KERNEL_VERSION($(word 1,$(aicwf_cfg80211_version)),$(word 2,$(aicwf_cfg80211_version)),$(word 3,$(aicwf_cfg80211_version)))' +endif + RWNX_VERS_NUM := 6.4.3.0 CONFIG_AIC8800_WLAN_SUPPORT = m diff --git a/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.c b/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.c index 14f5904..dba2b3e 100644 --- a/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.c +++ b/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.c @@ -1832,7 +1832,7 @@ void set_vendor_extension_ie(char *command){ } #endif//CONFIG_SET_VENDOR_EXTENSION_IE -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef); #else @@ -1840,7 +1840,7 @@ int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy, struct cfg80211_chan_def *chandef); #endif int rwnx_atoi2(char *value, int c_len); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) void set_mon_chan(struct rwnx_vif *vif, struct net_device *dev, char *parameter) #else void set_mon_chan(struct rwnx_vif *vif, char *parameter) @@ -1867,7 +1867,7 @@ void set_mon_chan(struct rwnx_vif *vif, char *parameter) chandef->center_freq1 = chandef->chan->center_freq; chandef->center_freq2 = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) rwnx_cfg80211_set_monitor_channel_(vif->rwnx_hw->wiphy, dev, chandef); #else rwnx_cfg80211_set_monitor_channel_(vif->rwnx_hw->wiphy, chandef); @@ -2136,7 +2136,7 @@ int android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) char *set_parameter; skip = strlen(CMD_SET_MON_FREQ) + 1; set_parameter = command + skip; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) set_mon_chan(vif, net, set_parameter); #else set_mon_chan(vif, set_parameter); diff --git a/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.h b/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.h index a51ae48..23230b1 100644 --- a/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.h +++ b/drivers/aic8800/aic8800_fdrv/aic_priv_cmd.h @@ -62,7 +62,7 @@ int get_cs_info(struct rwnx_vif *vif, u8 *mac_addr, u8 *val); unsigned int command_strtoul(const char *cp, char **endp, unsigned int base); int str_starts(const char *str, const char *start); int handle_private_cmd(struct net_device *net, char *command, u32 cmd_len); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) void set_mon_chan(struct rwnx_vif *vif, struct net_device *dev, char *parameter); #else void set_mon_chan(struct rwnx_vif *vif, char *parameter); diff --git a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80.c b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80.c index bdba575..80c6597 100644 --- a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80.c +++ b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80.c @@ -40,7 +40,8 @@ int rwnx_plat_userconfig_load_8800d80(struct rwnx_hw *rwnx_hw){ char *filename = FW_USERCONFIG_NAME_8800D80; #ifndef ANDROID_PLATFORM - sprintf(aic_fw_path, "%s/%s", aic_fw_path, "aic8800D80"); + if (strlcat(aic_fw_path, "/aic8800D80", sizeof(aic_fw_path)) >= sizeof(aic_fw_path)) + return -ENAMETOOLONG; #endif AICWFDBG(LOGINFO, "userconfig file path:%s \r\n", filename); diff --git a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80x2.c b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80x2.c index ef62e86..cf91592 100644 --- a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80x2.c +++ b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80x2.c @@ -41,7 +41,8 @@ int rwnx_plat_userconfig_load_8800d80x2(struct rwnx_hw *rwnx_hw){ char *filename = FW_USERCONFIG_NAME_8800D80X2; #ifndef ANDROID_PLATFORM - sprintf(aic_fw_path, "%s/%s", aic_fw_path, "aic8800D80X2"); + if (strlcat(aic_fw_path, "/aic8800D80X2", sizeof(aic_fw_path)) >= sizeof(aic_fw_path)) + return -ENAMETOOLONG; #endif AICWFDBG(LOGINFO, "userconfig file path:%s \r\n", filename); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_compat.h b/drivers/aic8800/aic8800_fdrv/rwnx_compat.h index 0719b20..f2e8eb3 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_compat.h +++ b/drivers/aic8800/aic8800_fdrv/rwnx_compat.h @@ -23,6 +23,11 @@ #define _RWNX_COMPAT_H_ #include +/* Keep wireless API checks separate from timer, USB and other kernel APIs. */ +#ifndef AICWF_CFG80211_VERSION_CODE +#define AICWF_CFG80211_VERSION_CODE LINUX_VERSION_CODE +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) #error "Minimum kernel version supported is 3.10" #endif diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index 594e4f9..37ae81b 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -2942,7 +2942,7 @@ bool key_flag = false; * when adding a group key. */ static int rwnx_cfg80211_add_key(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *netdev, @@ -2954,7 +2954,7 @@ static int rwnx_cfg80211_add_key(struct wiphy *wiphy, struct key_params *params) { struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *vif = netdev_priv(netdev); @@ -3066,7 +3066,7 @@ static int rwnx_cfg80211_add_key(struct wiphy *wiphy, * */ static int rwnx_cfg80211_get_key(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *netdev, @@ -3090,7 +3090,7 @@ static int rwnx_cfg80211_get_key(struct wiphy *wiphy, * and @key_index, return -ENOENT if the key doesn't exist. */ static int rwnx_cfg80211_del_key(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *netdev, @@ -3102,7 +3102,7 @@ static int rwnx_cfg80211_del_key(struct wiphy *wiphy, u8 key_index, bool pairwise, const u8 *mac_addr) { struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *vif = netdev_priv(netdev); @@ -3154,7 +3154,7 @@ static int rwnx_cfg80211_set_default_key(struct wiphy *wiphy, * @set_default_mgmt_key: set the default management frame key on an interface */ static int rwnx_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *netdev, @@ -3249,7 +3249,7 @@ static int rwnx_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, key_params.seq_len = 0; key_params.cipher = sme->crypto.cipher_group; rwnx_cfg80211_add_key(wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) &rwnx_vif->wdev, #else dev, @@ -3480,7 +3480,7 @@ static int rwnx_cfg80211_external_auth(struct wiphy *wiphy, struct net_device *d * @add_station: Add a new station. */ static int rwnx_cfg80211_add_station(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *dev, @@ -3493,7 +3493,7 @@ static int rwnx_cfg80211_add_station(struct wiphy *wiphy, struct station_parameters *params) { struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *rwnx_vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *rwnx_vif = netdev_priv(dev); @@ -3589,7 +3589,7 @@ static int rwnx_cfg80211_add_station(struct wiphy *wiphy, sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; #endif cfg80211_new_sta( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) &rwnx_vif->wdev, #else rwnx_vif->ndev, @@ -3620,7 +3620,7 @@ static int rwnx_cfg80211_add_station(struct wiphy *wiphy, (params->sta_flags_set & BIT(NL80211_STA_FLAG_##f) ? "["#f"]" : "") netdev_info( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) wdev->netdev, #else dev, @@ -3651,7 +3651,7 @@ static int rwnx_cfg80211_add_station(struct wiphy *wiphy, * @del_station: Remove a station */ static int rwnx_cfg80211_del_station_compat(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *dev, @@ -3666,7 +3666,7 @@ static int rwnx_cfg80211_del_station_compat(struct wiphy *wiphy, ) { struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *rwnx_vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *rwnx_vif = netdev_priv(dev); @@ -3711,7 +3711,7 @@ static int rwnx_cfg80211_del_station_compat(struct wiphy *wiphy, if(found) { netdev_info( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) wdev->netdev, #else dev, @@ -3731,7 +3731,7 @@ static int rwnx_cfg80211_del_station_compat(struct wiphy *wiphy, } if (rwnx_vif->wdev.iftype == NL80211_IFTYPE_AP || rwnx_vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) { cfg80211_del_sta( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) &rwnx_vif->wdev, #else rwnx_vif->ndev, @@ -3962,7 +3962,7 @@ void apm_probe_sta_work_process(struct work_struct *work) * cfg80211_check_station_change() to validate the information. */ static int rwnx_cfg80211_change_station(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *dev, @@ -3975,7 +3975,7 @@ static int rwnx_cfg80211_change_station(struct wiphy *wiphy, struct station_parameters *params) { struct rwnx_hw *rwnx_hw = wiphy_priv(wiphy); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *vif = netdev_priv(dev); @@ -3988,7 +3988,7 @@ static int rwnx_cfg80211_change_station(struct wiphy *wiphy, /* Add the TDLS station */ if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *rwnx_vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *rwnx_vif = netdev_priv(dev); @@ -4064,7 +4064,7 @@ static int rwnx_cfg80211_change_station(struct wiphy *wiphy, (params->sta_flags_set & BIT(NL80211_STA_FLAG_##f) ? "["#f"]" : "") netdev_info( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) wdev->netdev, #else dev, @@ -4353,7 +4353,7 @@ static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) /* delete any remaining STA*/ while (!list_empty(&rwnx_vif->ap.sta_list)) { rwnx_cfg80211_del_station_compat(wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) &rwnx_vif->wdev, #else dev, @@ -4420,7 +4420,7 @@ cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1, } #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef) #else @@ -4480,7 +4480,7 @@ static int rwnx_cfg80211_set_monitor_channel(struct wiphy *wiphy, } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef) @@ -4553,7 +4553,7 @@ void rwnx_cfg80211_mgmt_frame_register(struct wiphy *wiphy, * have changed. The actual parameter values are available in * struct wiphy. If returning an error, no value should be changed. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) static int rwnx_cfg80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed) #else static int rwnx_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) @@ -4574,7 +4574,7 @@ static int rwnx_cfg80211_set_tx_power(struct wiphy *wiphy, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) struct wireless_dev *wdev, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) int radio_idx, #endif enum nl80211_tx_power_setting type, int mbm) @@ -4611,10 +4611,10 @@ static int rwnx_cfg80211_get_tx_power(struct wiphy *wiphy, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) struct wireless_dev *wdev, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) int radio_idx, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) unsigned int link_id, #endif int *mbm) @@ -4858,7 +4858,7 @@ rwnx_cfg80211_remain_on_channel(struct wiphy *wiphy, enum nl80211_channel_type channel_type, #endif unsigned int duration, u64 *cookie -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 2, 0) /* * 7.2 added an optional receive address filter for the off-channel * period. cfg80211 refuses a non-NULL one unless the driver sets @@ -5009,7 +5009,7 @@ static int rwnx_cfg80211_get_channel(struct wiphy *wiphy, if (rwnx_vif->vif_index == rwnx_hw->monitor_vif) { //retrieve channel from firmware -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) rwnx_cfg80211_set_monitor_channel(wiphy, wdev->netdev, NULL); #else rwnx_cfg80211_set_monitor_channel(wiphy, NULL); @@ -5207,7 +5207,7 @@ int rwnx_cfg80211_start_radar_detection(struct wiphy *wiphy, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) , u32 cac_time_ms #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) , int link_id #endif ) @@ -5991,7 +5991,7 @@ int rwnx_fill_station_info(struct rwnx_sta *sta, struct rwnx_vif *vif, * @get_station: get station information for the station identified by @mac */ static int rwnx_cfg80211_get_station(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *dev, @@ -6003,7 +6003,7 @@ static int rwnx_cfg80211_get_station(struct wiphy *wiphy, #endif struct station_info *sinfo) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *vif = netdev_priv(dev); @@ -6041,14 +6041,14 @@ static int rwnx_cfg80211_get_station(struct wiphy *wiphy, * @dump_station: dump station callback -- resume dump at index @idx */ static int rwnx_cfg80211_dump_station(struct wiphy *wiphy, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct wireless_dev *wdev, #else struct net_device *dev, #endif int idx, u8 *mac, struct station_info *sinfo) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) struct rwnx_vif *rwnx_vif = netdev_priv(wdev->netdev); #else struct rwnx_vif *rwnx_vif = netdev_priv(dev); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.h b/drivers/aic8800/aic8800_fdrv/rwnx_main.h index d9081f6..86aec11 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.h +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.h @@ -91,7 +91,7 @@ void aicwf_p2p_alive_timeout(struct timer_list *t); int rwnx_send_check_p2p(struct cfg80211_scan_request *param); void apm_staloss_work_process(struct work_struct *work); void apm_probe_sta_work_process(struct work_struct *work); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) +#if (AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) int rwnx_cfg80211_set_monitor_channel_(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_msg_rx.c b/drivers/aic8800/aic8800_fdrv/rwnx_msg_rx.c index b02a116..386c28f 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_msg_rx.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_msg_rx.c @@ -825,7 +825,9 @@ static inline int rwnx_rx_scanu_result_ind(struct rwnx_hw *rwnx_hw, #endif } +#ifdef CONFIG_USE_WIRELESS_EXT putbss: +#endif if (bss != NULL) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(bss); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_platform.c b/drivers/aic8800/aic8800_fdrv/rwnx_platform.c index b85aa5b..d4da1b2 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_platform.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_platform.c @@ -1669,7 +1669,8 @@ static int rwnx_plat_patch_load(struct rwnx_hw *rwnx_hw) if(rwnx_hw->usbdev->chipid == PRODUCT_ID_AIC8800DC || rwnx_hw->usbdev->chipid == PRODUCT_ID_AIC8800DW){ #ifndef ANDROID_PLATFORM - sprintf(aic_fw_path, "%s/%s", aic_fw_path, "aic8800DC"); + if (strlcat(aic_fw_path, "/aic8800DC", sizeof(aic_fw_path)) >= sizeof(aic_fw_path)) + return -ENAMETOOLONG; #endif AICWFDBG(LOGINFO, "testmode=%d\n", testmode); if (chip_sub_id == 0) { @@ -1808,7 +1809,8 @@ static int rwnx_plat_patch_load(struct rwnx_hw *rwnx_hw) } } else if(rwnx_hw->usbdev->chipid == PRODUCT_ID_AIC8800D80N) { #ifndef ANDROID_PLATFORM - sprintf(aic_fw_path, "%s/%s", aic_fw_path, "aic8800D80N"); + if (strlcat(aic_fw_path, "/aic8800D80N", sizeof(aic_fw_path)) >= sizeof(aic_fw_path)) + return -ENAMETOOLONG; #endif if (testmode == FW_NORMAL_MODE) { ret = aicwf_plat_patch_load_8800d80n(rwnx_hw); @@ -1838,7 +1840,8 @@ static int rwnx_plat_patch_load(struct rwnx_hw *rwnx_hw) } else if(rwnx_hw->usbdev->chipid == PRODUCT_ID_AIC8800DLN) { #ifndef ANDROID_PLATFORM - sprintf(aic_fw_path, "%s/%s", aic_fw_path, "aic8800DLN"); + if (strlcat(aic_fw_path, "/aic8800DLN", sizeof(aic_fw_path)) >= sizeof(aic_fw_path)) + return -ENAMETOOLONG; #endif if (testmode == FW_NORMAL_MODE) { aicwf_patch_config_8800dln(rwnx_hw); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_radar.c b/drivers/aic8800/aic8800_fdrv/rwnx_radar.c index 0772f47..4a59057 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_radar.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_radar.c @@ -1475,7 +1475,7 @@ static void rwnx_radar_cac_work(struct work_struct *ws) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) &ctxt->chan_def, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) NL80211_RADAR_CAC_FINISHED, GFP_KERNEL, 0); #else NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); @@ -1617,7 +1617,7 @@ void rwnx_radar_cancel_cac(struct rwnx_radar *radar) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) &ctxt->chan_def, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) NL80211_RADAR_CAC_FINISHED, GFP_KERNEL, 0); #else NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_rx.c b/drivers/aic8800/aic8800_fdrv/rwnx_rx.c index 565b138..6287682 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_rx.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_rx.c @@ -2410,7 +2410,7 @@ check_len_update: hdr = (struct ieee80211_hdr *)(skb->data + msdu_offset); rwnx_vif = rwnx_rx_get_vif(rwnx_hw, hw_rxhdr->flags_vif_idx); if (rwnx_vif) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) cfg80211_rx_spurious_frame(rwnx_vif->ndev, hdr->addr2, -1, GFP_ATOMIC); #else cfg80211_rx_spurious_frame(rwnx_vif->ndev, hdr->addr2, GFP_ATOMIC); @@ -2757,7 +2757,7 @@ check_len_update: if (hw_rxhdr->flags_is_4addr && !rwnx_vif->use_4addr) { printk("aicwf: 4addr flag error\n"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 17, 0) cfg80211_rx_unexpected_4addr_frame(rwnx_vif->ndev, sta->mac_addr, -1, GFP_ATOMIC); #else diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c b/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c index 1759b84..b9ed49a 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c @@ -115,7 +115,7 @@ rwnx_prep_tdls_direct(struct rwnx_hw *rwnx_hw, struct rwnx_vif *rwnx_vif, switch (action_code) { case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) +#if AICWF_CFG80211_VERSION_CODE >= KERNEL_VERSION(7, 1, 0) skb_put(skb, 2 + sizeof(mgmt->u.action.tdls_discover_resp)); mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; mgmt->u.action.action_code = WLAN_PUB_ACTION_TDLS_DISCOVER_RES;