Bug#525315: better hysteresis for wpa_action
I have been much happier since I installed the attached script and configured /etc/wpa_supplicant/ifupdown.sh to use it instead of /sbin/wpa_action. It delays disconnect events for 5 seconds, and if a new connect comes within that time, it cancels the disconnect. Other than that, events are passed along to the real wpa_action script. It's not done, because it doesn't check whether a connect event is for a new network, in which case we need to disconnect and reconnect. I think it would be much better to integrate this into wpa_cli, as that would probably reduce the locking complexity and be more reliable than a shell script. Andrew -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#525315: better hysteresis for wpa_action
attached #!/bin/sh IFACE=$1 ACTION=$2 SELF=$$ PENDING_FILE=/tmp/pending_disconnect.$IFACE.lock log () { echo $(date '+%F %T') $@ /tmp/wpa_action.$IFACE.log } lock () { lockfile /tmp/wpa_action.$IFACE.lock } unlock () { rm -f /tmp/wpa_action.$IFACE.lock } # Note: wpa_cli runs us synchronously, so go into the background to wait case $ACTION in CONNECTED) lockfile /tmp/wpa_action.lock if [ -e $PENDING_FILE ]; then log CONNECTED, cancelling pending disconnect rm $PENDING_FILE else log CONNECTED, doing real connect /sbin/wpa_action $@ fi rm -f /tmp/wpa_action.lock ;; DISCONNECTED) log DISCONNECTED, scheduling disconnect ($SELF) echo $SELF $PENDING_FILE ( sleep 5 lockfile /tmp/wpa_action.lock if [ -e $PENDING_FILE $SELF = $(cat $PENDING_FILE) ]; then log resuming $SELF, doing real disconnect rm $PENDING_FILE /sbin/wpa_action $@ else log resuming $SELF, cancelled fi rm -f /tmp/wpa_action.lock ) ;; *) log whah?? $ACTION ;; esac