From 8f04e62ca7fc50a0d01f012dd1ae7b4fda5f6b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bremv=C3=A5g?= Date: Fri, 16 Aug 2019 22:53:33 +0200 Subject: [PATCH] Fix incorrect response to SIOCGIWESSID When not associated with an AP, wifi device drivers should respond to the SIOCGIWESSID ioctl with a zero-length string for the SSID, which is the behavior expected by dhcpcd. Currently, this driver returns an error code (-1) from the ioctl call, which causes dhcpcd to assume that the device is not a wireless interface and therefore it fails to work correctly with it thereafter. When not associated with an AP, other wifi device drivers respond to the SIOCGIWESSID ioctl with a zero-length string for the SSID; this is the behaviour expected by dhcpcd. This driver returns an error code (-1) from the ioctl call - this causes dhcpcd to assume that the device is not a wireless interface and therefore it fails to work correctly with it thereafter. It would be good if the behaviour of this driver could be brought into line with that of other drivers for similar devices; that is for the response to SIOCGIWESSID to be a zero-length string and a success code rather than an error. --- os_dep/linux/ioctl_linux.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 9afa510..20f0f33 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -2456,18 +2456,15 @@ static int rtw_wx_get_essid(struct net_device *dev, (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) { len = pcur_bss->Ssid.SsidLength; - wrqu->essid.length = len; - _rtw_memcpy(extra, pcur_bss->Ssid.Ssid, len); - wrqu->essid.flags = 1; } else { - ret = -1; - goto exit; + len = 0; + *extra = 0; } -exit: - + wrqu->essid.length = len; + wrqu->essid.flags = 1; return ret;