[pkg-wpa-devel] [RFC]: workaround for sendsigs/wpa_supplicant
process conflict
Kel Modderman
kelrin at tpg.com.au
Wed Jun 21 13:33:46 UTC 2006
Hi!
I've been sitting on an idea to workaround the problem of sendsigs
terminating wpa_supplicant, and therefore, causing an interface
previously under wpa_supplicants control to be brought down in an
unclean manner. This concept was explored while looking for a better
solution to closing wpa_action daemons.
Basically I propose an init script that is called only at sequence
number 15 in runlevels 0 and 6 that searches for wpa_{supplicant,cli}
pidfiles that have been created via ifupdown.sh, and brings down these
interfaces before sendsigs is invoked (via ifdown).
svn diff is attached, and a package snapshot for testing is available at:
http://users.tpg.com.au/sigm/misc/pkg-wpa/
It affects: #373180 and possibly allows a better workaround for problem
described in the "umounting nfs mounts" bug by Elimar.
Thanks, Kel.
-------------- next part --------------
Index: debian/changelog
===================================================================
--- debian/changelog (revision 519)
+++ debian/changelog (working copy)
@@ -16,8 +16,12 @@
* Manpages have been slightly enhanced, and now briefly explain wpa_cli
action environment variables and wpa_supplicant -C and -g options.
(Closes: #372615)
+ * Add workaround for sendsigs (initscripts) terminating wpa_supplicant
+ processes before networking is shutdown gracefully. An init script
+ wpa-ifupdown is called at sequence number 15 in runlevels 0 and 6 to bring
+ down all interfaces that were started via ifupdown.sh.
- -- Kel Modderman <kelrin at tpg.com.au> Wed, 21 Jun 2006 18:46:49 +1000
+ -- Kel Modderman <kelrin at tpg.com.au> Wed, 21 Jun 2006 23:00:18 +1000
wpasupplicant (0.5.3+20060522-3) unstable; urgency=low
Index: debian/rules
===================================================================
--- debian/rules (revision 514)
+++ debian/rules (working copy)
@@ -18,6 +18,8 @@
debian/wpasupplicant/etc/wpa_supplicant/ifupdown.sh
install --mode=755 -D debian/wpa_action.sh \
debian/wpasupplicant/sbin/wpa_action
+ dh_installinit --no-start --name=wpa-ifupdown \
+ --update-rcd-params="start 15 0 6 ."
dh_installlogrotate --name=wpa_action
clean::
Index: debian/wpasupplicant.wpa-ifupdown.init
===================================================================
--- debian/wpasupplicant.wpa-ifupdown.init (revision 0)
+++ debian/wpasupplicant.wpa-ifupdown.init (revision 0)
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides: wpa-ifupdown
+# Default-Start: start 15 0 6
+# Description: Stop wpa_supplicant processes started via ifupdown
+### END INIT INFO
+
+### Background
+# sendsigs (initscripts) terminates wpa_supplicant processes before
+# networking is stopped. This causes interfaces that were connected
+# via wpa_supplicant to be brought down uncleanly.
+
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+
+test -d /var/run || exit 0
+test -x /sbin/ifdown || exit 0
+
+. /lib/lsb/init-functions
+
+stop_wpa_action () {
+ test -x /sbin/wpa_action || return 0
+ for iface in $(find /var/run -maxdepth 1 -type f -name 'wpa_cli-roam.*.pid' -printf '%P\n' | cut -d'.' -f2); do
+ log_action_msg "Stopping wpa_action roaming interface $iface"
+ # wpa_action executes /sbin/ifdown
+ /sbin/wpa_action $iface stop
+ done
+}
+
+stop_wpa_supplicant () {
+ for iface in $(find /var/run -maxdepth 1 -type f -name 'wpa_supplicant.*.pid' -printf '%P\n' | cut -d'.' -f2); do
+ if grep -q "^$iface" /etc/network/run/ifstate; then
+ log_action_msg "Stopping wpa_supplicant on $iface via ifupdown"
+ /sbin/ifdown $iface
+ fi
+ done
+}
+
+case "$1" in
+ stop)
+ stop_wpa_action
+ stop_wpa_supplicant
+ ;;
+ start|restart|force-reload)
+ # no-op
+ ;;
+ *)
+ log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
More information about the Pkg-wpa-devel
mailing list