1
0
mirror of https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git synced 2025-04-29 15:19:40 +02:00

Fix build regression && fix build compat bugs (#217)

1. Fix build regression os_dep/linux/ioctl_cfg80211.c:3654:12: error: ‘struct net_device’ has no member named ‘destructor’; did you mean ‘priv_destructor’?
  mon_ndev->destructor = rtw_ndev_destructor;
2. Fix build compat with kernel >= 4.12.0
3. Fix various errors in ioctl_cfg80211.c
This commit is contained in:
Chen Minqiang 2017-07-10 05:19:52 +08:00 committed by Harshavardhana
parent cc07a9cfd5
commit 2c6399ff11
2 changed files with 38 additions and 8 deletions

View File

@ -870,7 +870,7 @@ endif
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
#EXTRA_CFLAGS += -DCONFIG_P2P_IPS
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)

View File

@ -681,7 +681,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
}
} else {
if(scanned == NULL)
rtw_warn_on(1);
return;
if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == _TRUE
&& _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == _TRUE
@ -780,6 +780,9 @@ check_bss:
struct ieee80211_channel *notify_channel;
u32 freq;
u16 channel = cur_network->network.Configuration.DSConfig;
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 11, 9)
struct cfg80211_roam_info roam_info = {};
#endif
if (channel <= RTW_CH_MAX_2G_CHANNEL)
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
@ -790,6 +793,15 @@ check_bss:
#endif
DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 11, 9)
roam_info.channel = notify_channel;
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;
roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6;
roam_info.resp_ie_len = pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6;
cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
#else
cfg80211_roamed(padapter->pnetdev
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
, notify_channel
@ -800,6 +812,7 @@ check_bss:
, pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6
, pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6
, GFP_ATOMIC);
#endif
} else {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
@ -1151,7 +1164,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
if (param->u.crypt.idx >= WEP_KEYS
#ifdef CONFIG_IEEE80211W
&& param->u.crypt.idx > BIP_MAX_KEYID
|| param->u.crypt.idx >= BIP_MAX_KEYID
#endif //CONFIG_IEEE80211W
) {
ret = -EINVAL;
@ -1174,7 +1187,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
wep_key_idx = param->u.crypt.idx;
wep_key_len = param->u.crypt.key_len;
if ((wep_key_idx > WEP_KEYS) || (wep_key_len <= 0)) {
if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) {
ret = -EINVAL;
goto exit;
}
@ -1699,7 +1712,10 @@ enum nl80211_iftype {
*/
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type, u32 *flags,
enum nl80211_iftype type,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
u32 *flags,
#endif
struct vif_params *params)
{
enum nl80211_iftype old_type;
@ -3448,8 +3464,10 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de
DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
if (skb)
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
if (!skb)
goto fail;
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
goto fail;
@ -3651,7 +3669,13 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0))
mon_ndev->name_assign_type = name_assign_type;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,9))
mon_ndev->needs_free_netdev = false;
mon_ndev->priv_destructor = rtw_ndev_destructor;
#else
mon_ndev->destructor = rtw_ndev_destructor;
#endif
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
@ -3718,7 +3742,11 @@ cfg80211_rtw_add_virtual_intf(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0))
unsigned char name_assign_type,
#endif
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
enum nl80211_iftype type,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
u32 *flags,
#endif
struct vif_params *params)
{
int ret = 0;
struct net_device* ndev = NULL;
@ -5897,7 +5925,9 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
#endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9)
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#endif
#ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
#endif