From 0db73d6ac2f75857504ac2ba5a71c0f9b395cfd0 Mon Sep 17 00:00:00 2001 From: Carlos Garces Date: Wed, 23 Oct 2019 20:00:07 +0200 Subject: [PATCH] Fix compilation issue with kernel < 4.9 --- .travis.yml | 52 +++++++++-------------------------- os_dep/linux/ioctl_cfg80211.c | 2 ++ os_dep/linux/os_intfs.c | 3 +- os_dep/osdep_service.c | 6 ++-- 4 files changed, 21 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index a8cc75d..b09e171 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: c compiler: gcc sudo: required -dist: xenial +dist: bionic -before_install: +install: - export ALL_DEB=$(wget --quiet -O - ${KERNEL_URL}v${KVER}/ | grep -o 'href=".*"' | grep -m1 all | cut -d '"' -f 2) - export KVER_BUILD=$(echo $ALL_DEB | cut -d '_' -f 1 | cut -c15-) - wget ${KERNEL_URL}v${KVER}/$(wget --quiet -O - ${KERNEL_URL}v${KVER}/ | grep -o 'href=".*"' | grep headers | grep generic | grep -m1 amd64 | cut -d '"' -f 2) @@ -22,65 +22,39 @@ matrix: addons: apt: sources: - - sourceline: 'ppa:ondrej/nginx-mainline' + - ubuntu-toolchain-r-test packages: - - libssl1.1 - env: COMPILER=gcc-5 KVER=5.3 + - gcc-5 + env: COMPILER=gcc-5 KVER=5.3.7 - compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:ondrej/nginx-mainline' packages: - gcc-6 - - libssl1.1 - env: COMPILER=gcc-6 KVER=5.3 + env: COMPILER=gcc-6 KVER=5.3.7 + - compiler: gcc + env: COMPILER=gcc-7 KVER=5.3.7 - compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:ondrej/nginx-mainline' packages: - - gcc-7 - - libssl1.1 - env: COMPILER=gcc-7 KVER=5.3 - - compiler: gcc - addons: - apt: - sources: - - sourceline: 'ppa:ondrej/nginx-mainline' - packages: - - libssl1.1 - env: COMPILER=gcc-5 KVER=4.19.45 + - gcc-5 + env: COMPILER=gcc-5 KVER=4.19.67 - compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:ondrej/nginx-mainline' packages: - gcc-6 - - libssl1.1 - env: COMPILER=gcc-6 KVER=4.19.45 + env: COMPILER=gcc-6 KVER=4.19.67 - compiler: gcc - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:ondrej/nginx-mainline' - packages: - - gcc-7 - - libssl1.1 env: COMPILER=gcc-7 KVER=4.19.67 - compiler: gcc - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:ondrej/nginx-mainline' - packages: - - gcc-7 - - libssl1.1 env: COMPILER=gcc-7 KVER=4.15.18 + - compiler: gcc + env: COMPILER=gcc-7 KVER=4.9.197 diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 4e108fe..3c18696 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4165,9 +4165,11 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne ret = -ENOMEM; goto out; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) mon_ndev->min_mtu = WLAN_MIN_ETHFRM_LEN; mon_ndev->mtu = WLAN_DATA_MAXLEN; mon_ndev->max_mtu = WLAN_DATA_MAXLEN; +#endif mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; strncpy(mon_ndev->name, name, IFNAMSIZ); diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index f0fe633..9c9229e 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1477,10 +1477,11 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter) if (!pnetdev) return NULL; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN; pnetdev->mtu = WLAN_DATA_MAXLEN; pnetdev->max_mtu = WLAN_DATA_MAXLEN; - +#endif padapter = rtw_netdev_priv(pnetdev); padapter->pnetdev = pnetdev; diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index d333b1f..c295eee 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2059,10 +2059,11 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_p if (!pnetdev) goto RETURN; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN; pnetdev->mtu = WLAN_MAX_ETHFRM_LEN; pnetdev->max_mtu = WLAN_DATA_MAXLEN; - +#endif pnpi = netdev_priv(pnetdev); pnpi->priv = old_priv; pnpi->sizeof_priv = sizeof_priv; @@ -2084,10 +2085,11 @@ struct net_device *rtw_alloc_etherdev(int sizeof_priv) if (!pnetdev) goto RETURN; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN; pnetdev->mtu = WLAN_MAX_ETHFRM_LEN; pnetdev->max_mtu = WLAN_DATA_MAXLEN; - +#endif pnpi = netdev_priv(pnetdev); pnpi->priv = rtw_zvmalloc(sizeof_priv);