[Bug 278306] service netif start doesn't bring up the wireless interface if /etc/wpa_supplicant.conf is missing

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 29 Aug 2024 11:50:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278306

Bjoern A. Zeeb <bz@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Open                        |In Progress

--- Comment #10 from Bjoern A. Zeeb <bz@FreeBSD.org> ---
(In reply to Oleksandr Kryvulia from comment #9)

Thanks for the feedback.  That in theory seems the right solution to me.

If we wanted to "automate" this and let meta-flags like DHCP and WPA count as
well, then we probably want to make sure the IF is up before wpa or hostapd
start?

I am not good at this and I probably do not understand all the possible
side-effects but maybe someone from rc@ or net@ can review this?  I wonder if
this would do the right thing...


diff --git libexec/rc/network.subr libexec/rc/network.subr
index 257643f48ba5..7e8502273353 100644
--- libexec/rc/network.subr
+++ libexec/rc/network.subr
@@ -216,14 +216,15 @@ ifconfig_up()
                ${IFCONFIG_CMD} $1 description "${_ifconfig_descr}"
        fi

+       if [ ${_cfg} -eq 0 ]; then
+               ${IFCONFIG_CMD} $1 up
+       fi
        if wpaif $1; then
                /etc/rc.d/wpa_supplicant start $1
                _cfg=0          # XXX: not sure this should count
        elif hostapif $1; then
                /etc/rc.d/hostapd start $1
                _cfg=0
-       elif [ ${_cfg} -eq 0 ]; then
-               ${IFCONFIG_CMD} $1 up
        fi

        if ! noafif $1 && afexists inet6; then

-- 
You are receiving this mail because:
You are the assignee for the bug.