commit:     ace10427ce3ffe912d349cd8aea32673ecd719d9
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Thu Feb 29 19:42:14 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed May  8 01:22:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ace10427

net-wireless/wpa_supplicant: call service stop on AP disconnect

Lot of discussion in the primary ticket for this, but apparently
multiple users report that previously connected wifi does not come up on
resume from suspend.  This is due to the original implementation
wpa_cli.sh not stopping the service, which was to avoid taking the
interface down, which would interfere with wpa_supplicant which needs
the interface to be up.  However, nowadays we set IN_BACKGROUND which
takes care of preventing the interface from being taken down, so it's
safe to stop the service.  If the service isn't stopped, then trying to
start the service on reconnection is a no-op (because the service is
already started).

Closes: https://bugs.gentoo.org/591752
Closes: https://bugs.gentoo.org/909574
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/35579
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 net-wireless/wpa_supplicant/files/wpa_cli-r1.sh    | 44 ++++++++++++++++++++++
 ...t-9999.ebuild => wpa_supplicant-2.10-r5.ebuild} |  4 +-
 .../wpa_supplicant/wpa_supplicant-9999.ebuild      |  2 +-
 3 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/net-wireless/wpa_supplicant/files/wpa_cli-r1.sh 
b/net-wireless/wpa_supplicant/files/wpa_cli-r1.sh
new file mode 100644
index 000000000000..dc852f427f4c
--- /dev/null
+++ b/net-wireless/wpa_supplicant/files/wpa_cli-r1.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Copyright 1999-2011 Gentoo Foundation
+# Written by Roy Marples <uberl...@gentoo.org>
+# Distributed under the terms of the GNU General Public License v2
+# Alternatively, this file may be distributed under the terms of the BSD 
License
+
+if [ -z "$1" -o -z "$2" ]; then
+       logger -t wpa_cli "Insufficient parameters"
+       exit 1
+fi
+
+INTERFACE="$1"
+ACTION="$2"
+
+# Note, the below action must NOT mark the interface down via ifconfig, ip or
+# similar. Addresses can be removed, changed and daemons can be stopped, but
+# the interface must remain up for wpa_supplicant to work.
+
+if [ -f /etc/gentoo-release ]; then
+       EXEC="/etc/init.d/net.${INTERFACE} --quiet"
+else
+       logger -t wpa_cli "I don't know what to do with this distro!"
+       exit 1
+fi
+
+case ${ACTION} in
+       CONNECTED)
+               EXEC="${EXEC} start"
+               ;;
+       DISCONNECTED)
+               EXEC="${EXEC} --nodeps stop"
+               ;;
+       *)
+               logger -t wpa_cli "Unknown action ${ACTION}"
+               exit 1
+               ;;
+esac
+
+# ${EXEC} can use ${IN_BACKGROUND} so that it knows that the user isn't
+# stopping the interface and a background process - like wpa_cli - is.
+export IN_BACKGROUND=true
+
+logger -t wpa_cli "interface ${INTERFACE} ${ACTION}"
+${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed"

diff --git a/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild 
b/net-wireless/wpa_supplicant/wpa_supplicant-2.10-r5.ebuild
similarity index 98%
copy from net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
copy to net-wireless/wpa_supplicant/wpa_supplicant-2.10-r5.ebuild
index 5778596a4275..2a500901cf60 100644
--- a/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
+++ b/net-wireless/wpa_supplicant/wpa_supplicant-2.10-r5.ebuild
@@ -13,7 +13,7 @@ if [ "${PV}" = "9999" ]; then
        inherit git-r3
        EGIT_REPO_URI="https://w1.fi/hostap.git";
 else
-       KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~loong ~mips ppc ppc64 ~riscv 
~sparc x86"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~sparc ~x86"
        SRC_URI="https://w1.fi/releases/${P}.tar.gz";
 fi
 
@@ -393,7 +393,7 @@ src_install() {
        newconfd "${FILESDIR}/${PN}-conf.d" wpa_supplicant
 
        exeinto /etc/wpa_supplicant/
-       newexe "${FILESDIR}/wpa_cli.sh" wpa_cli.sh
+       newexe "${FILESDIR}/wpa_cli-r1.sh" wpa_cli.sh
 
        readme.gentoo_create_doc
        dodoc ChangeLog {eap_testing,todo}.txt README{,-WPS} \

diff --git a/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild 
b/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
index 5778596a4275..75c7a436d746 100644
--- a/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
+++ b/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
@@ -393,7 +393,7 @@ src_install() {
        newconfd "${FILESDIR}/${PN}-conf.d" wpa_supplicant
 
        exeinto /etc/wpa_supplicant/
-       newexe "${FILESDIR}/wpa_cli.sh" wpa_cli.sh
+       newexe "${FILESDIR}/wpa_cli-r1.sh" wpa_cli.sh
 
        readme.gentoo_create_doc
        dodoc ChangeLog {eap_testing,todo}.txt README{,-WPS} \

Reply via email to