git: f9d2cbc6a526 - stable/13 - wpa: Address CTRL-EVENT-SCAN-FAILED

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 04 Nov 2021 18:32:12 UTC
The branch stable/13 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=f9d2cbc6a5267003042663e0311d1b9d86ba4e36

commit f9d2cbc6a5267003042663e0311d1b9d86ba4e36
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2021-09-07 01:48:39 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2021-11-04 18:30:25 +0000

    wpa: Address CTRL-EVENT-SCAN-FAILED
    
    Some installations may experience CTRL-EVENT-SCAN-FAILED when
    associating to an AP. Installations that specify
    ifconfig_wlan0="WPA ... up" in rc.conf do not experience
    the problem whereas those which specify ifconfig_wlan0="WPA" without
    the "up" will experience CTRL-EVENT-SCAN_FAILED.
    
    However those that specify "up" in ifconfig_wlan0 will be able to
    reproduce this problem by service netif stop wlan0;
    service netif start wlan0. Interestingly The service netif stop/start
    problem is reproducible on the older wpa 2.9 as well.
    
    Reported by:    dhw
    Reported by:    "Oleg V. Nauman" <oleg _ theweb_org_ua>
    Reported by:    Filipe da Silva Santos <contact _ shiori_com_br>
    Reported by:    Jakob Alvermark <jakob _ alvermark_net>
    
    (cherry picked from commit 5fcdc19a81115d975e238270754e28557a2fcfc5)
---
 libexec/rc/rc.d/wpa_supplicant | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant
index 8a86fec90e4d..3c5c9d243f68 100755
--- a/libexec/rc/rc.d/wpa_supplicant
+++ b/libexec/rc/rc.d/wpa_supplicant
@@ -12,6 +12,7 @@
 
 name="wpa_supplicant"
 desc="WPA/802.11i Supplicant for wireless network devices"
+start_postcmd="wpa_poststart"
 rcvar=
 
 ifn="$2"
@@ -27,6 +28,10 @@ is_ndis_interface()
 	esac
 }
 
+wpa_poststart() {
+	ifconfig ${ifn} up
+}
+
 if is_wired_interface ${ifn} ; then
 	driver="wired"
 elif is_ndis_interface ${ifn} ; then