diff --git a/Makefile b/Makefile index 043d673..facefe2 100755 --- a/Makefile +++ b/Makefile @@ -10,6 +10,11 @@ EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-vla EXTRA_CFLAGS += -Wno-date-time +REDHAT_VER := $(shell cut -f4 -d" " /etc/redhat-release |cut -d"." -f1,2 ) +ifeq ($(REDHAT_VER), 7.9) +EXTRA_CFLAGS += -DRHEL79 +endif + GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) ifeq ($(GCC_VER_49),1) EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later diff --git a/README.md b/README.md index af1b00e..0742ceb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +Like https://github.com/cccooo/rtl8812au-centos-7.6, forked from aircrack-ng/rtl8188eus and modified for CentOS 7.9 +as CentOS Kernel 3.10 contains many code from 4.x + ## rtl8188eus v5.3.9 # Realtek rtl8188eus & rtl8188eu & rtl8188etv WiFi drivers diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index fb8a2cf..ee26f89 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -27,7 +27,7 @@ #define DBG_RTW_CFG80211_MESH_CONF 0 #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) || defined(RHEL79)) #define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME) #define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID) #define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID) @@ -289,7 +289,7 @@ static const char *nl80211_chan_width_str(enum nl80211_chan_width cwidth) return "80+80"; case NL80211_CHAN_WIDTH_160: return "160"; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79)) case NL80211_CHAN_WIDTH_5: return "5"; case NL80211_CHAN_WIDTH_10: @@ -390,7 +390,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef, *ch = chan->hw_value; break; case NL80211_CHAN_WIDTH_80P80: - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79)) case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: #endif @@ -944,7 +944,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wireless_dev *pwdev = padapter->rtw_wdev; struct cfg80211_bss *bss = NULL; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79)) struct wiphy *wiphy = pwdev->wiphy; int freq = 2412; struct ieee80211_channel *notify_channel; @@ -1002,7 +1002,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); } /* notify cfg80211 that device joined an IBSS */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79)) notify_channel = ieee80211_get_channel(wiphy, freq); cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC); #else @@ -1090,7 +1090,7 @@ check_bss: struct ieee80211_channel *notify_channel; u32 freq; u16 channel = cur_network->network.Configuration.DSConfig; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79)) struct cfg80211_roam_info roam_info; #endif @@ -1098,7 +1098,7 @@ check_bss: notify_channel = ieee80211_get_channel(wiphy, freq); #endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79)) roam_info.bssid = cur_network->network.MacAddress; roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; @@ -1126,7 +1126,7 @@ check_bss: rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA); #endif } else { - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if !defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)) RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); #endif @@ -1137,7 +1137,7 @@ check_bss: , pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6 , pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6 , WLAN_STATUS_SUCCESS, GFP_ATOMIC); - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)) RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state); #endif } @@ -1193,7 +1193,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL); if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) { - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) + #if (!defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE))) RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); if (pwdev->sme_state == CFG80211_SME_CONNECTING) { @@ -2448,7 +2448,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted) struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); _irqL irqL; -#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) +#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79)) struct cfg80211_scan_info info; memset(&info, 0, sizeof(info)); @@ -2465,7 +2465,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted) if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) RTW_INFO("error wiphy compare\n"); else -#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) +#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79)) cfg80211_scan_done(pwdev_priv->scan_request, &info); #else cfg80211_scan_done(pwdev_priv->scan_request, aborted); @@ -3055,7 +3055,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy check_need_indicate_scan_done: if (_TRUE == need_indicate_scan_done) { -#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) +#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79)) struct cfg80211_scan_info info; memset(&info, 0, sizeof(info)); @@ -3063,7 +3063,7 @@ check_need_indicate_scan_done: #endif _rtw_cfg80211_surveydone_event_callback(padapter, request); -#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) +#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79)) cfg80211_scan_done(request, &info); #else cfg80211_scan_done(request, 0); @@ -9146,7 +9146,8 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) + LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \ + !defined(RHEL79)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; #ifdef CONFIG_PNO_SUPPORT wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; @@ -9157,7 +9158,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(RHEL79)) wiphy->wowlan = wowlan_stub; #else wiphy->wowlan = &wowlan_stub; diff --git a/os_dep/linux/ioctl_cfg80211.h b/os_dep/linux/ioctl_cfg80211.h index d99844f..01b6e76 100644 --- a/os_dep/linux/ioctl_cfg80211.h +++ b/os_dep/linux/ioctl_cfg80211.h @@ -362,7 +362,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy); #define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) && !defined(RHEL79)) #define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp) #else #define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp) @@ -384,7 +384,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy); u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht); #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL79) ) #define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ #define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 73ccf28..da8eff3 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -294,7 +294,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy) && rtw_odm_dfs_domain_unknown(padapter) #endif ) { - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79)) ch->flags = (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN); #else ch->flags = IEEE80211_CHAN_NO_IR; @@ -309,7 +309,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy) #endif ) { ch->flags |= IEEE80211_CHAN_RADAR; - #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79)) ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN); #else ch->flags |= IEEE80211_CHAN_NO_IR; @@ -374,7 +374,7 @@ static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy wiphy->reg_notifier = rtw_reg_notifier; #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79)) wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;