aircrack-ng / rtl8188eus

RealTek RTL8188eus WiFi driver with monitor mode & frame injection support
940 stars 401 forks source link

Compilation error against kernel 6.8.x #291

Open pavelrangelov opened 3 weeks ago

pavelrangelov commented 3 weeks ago

Can't compile anymore with kernel 6.8.x. With kernel 6.5.0 it compiles without errors. Distro: Kubuntu 22.04.4 LTS

rtl8188eus/os_dep/linux/usb_intf.c:310:17: error: ‘struct usb_driver’ has no member named ‘drvwrap’ .usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,

rtl8188eus/os_dep/linux/usb_intf.c:310:43: error: initialization of ‘const char *’ from incompatible pointer type ‘void (*)(struct device *)’ [-Werror=incompatible-pointer-types]

pavelrangelov commented 3 weeks ago

I found a similar driver that has already been patched for the 6.8.x kernel. So I applied the changes to this driver and it compiles and works. Except for a bunch of warnings about missing function prototypes (probably missing some header file). This is my temporary solution until the driver is fixed.

File: rtl8188eus/os_dep/linux/usb_intf.c line 309 replace

if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))

with

if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0))

File: rtl8188eus/os_dep/linux/ioctl_cfg80211.c line 4898 replace entire function

static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
        struct cfg80211_beacon_data *info)
{
    int ret = 0;
    _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);

    RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));

    ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);

    return ret;
}

with

static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
        struct cfg80211_ap_update *params)
#else
        struct cfg80211_beacon_data *info)
#endif
{
    int ret = 0;
    _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
    struct cfg80211_beacon_data *info = &params->beacon;
#endif

    RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));

    ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);

    return ret;
}