From 419abdb265a9916260724b6c8a4247795f5f7943 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 25 Apr 2023 13:37:52 -0400 Subject: [PATCH] openbsd_wlan: Add implementation of IEEE80211_IOC_SCAN_REQ. We cannot actually initiate scans, but we can at least detect when one is in progress. This fixes "ifconfig ... scan" on OpenBSD devices returning errors instead of scan results ("list" always worked.) --- .../openbsd_wlan/net80211/ieee80211_haiku.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libs/compat/openbsd_wlan/net80211/ieee80211_haiku.cpp b/src/libs/compat/openbsd_wlan/net80211/ieee80211_haiku.cpp index 7906c5a6be..852faee6e5 100644 --- a/src/libs/compat/openbsd_wlan/net80211/ieee80211_haiku.cpp +++ b/src/libs/compat/openbsd_wlan/net80211/ieee80211_haiku.cpp @@ -177,6 +177,22 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length) return B_BAD_ADDRESS; switch (ireq.i_type) { + case IEEE80211_IOC_SCAN_REQ: { + if (op != SIOCS80211) + return B_BAD_VALUE; + + // SIOCS80211SCAN is a no-op, scans cannot actually be initiated. + // But we can at least check if one is already in progress. + status_t status = EBUSY; + + IFF_LOCKGIANT(ifp); + if (ic->ic_state == IEEE80211_S_SCAN || (ic->ic_flags & IEEE80211_F_BGSCAN) != 0) + status = EINPROGRESS; + IFF_UNLOCKGIANT(ifp); + + return status; + } + case IEEE80211_IOC_SCAN_RESULTS: { if (op != SIOCG80211) return B_BAD_VALUE;