Package: ifplugd
Version: 0.28-11
Severity: wishlist
Tags: patch

Debian's wpasupplicant package provides a mechanism for wireless
interfaces to roam between networks by ifup/ifdown on wireless
connected/disconnected events in a similar way that ifplugd operates for
wired ethernet devices upon plug events. I'd like to propose that
ifplugd consider interacting with wpa-roam managed wireless interfaces
on its action events; disconnecting wireless on "up" action, and
reconnecting wireless on "down" action.

An example /etc/network/interfaces below is an example of a system that
would roam to all networks that only require DHCP, and ethernet is used
when a cable is plugged in, and wireless is used at all other times (am
also using patch sent to #468896 for the "allow-ifplugd" feature):

allow-ifplugd eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
        wpa-roam /etc/wpa_supplicant/conf

iface default inet dhcp

(More granular roaming possible by using wpa-roam network id strings and
guessnet as mapping script for wired ethernet...then "logical" network
settings could exist in /e/n/i quite nicely for both wired and
wireless networks)

Attaching patch for discussion and testing. wpa_roam.action works more reliably
when action scripts are executed in reverse order for down action. It
should be executed before ifupdown.action on up action (hence the name
of installed script starts with "action", scripts are executed in
lexical sort order by run-parts) and after ifupdown.action on down action.

I think it can be default behaviour, wpa-roam users do not want multiple
routes, and when a cable is present I expect it should always be prefered
over wireless. wpa_roam.action will _not_ interfere with any other use
of wpa_supplicant other than if it were started in wpa-roam mode, the
`wpa_action "${IFACE}" check` sanity check ensires it.

Thanks, Kel.
---
--- a/debian/rules
+++ b/debian/rules
@@ -68,6 +68,7 @@
        install -m 755 debian/ifplugd.udev.agent 
$(CURDIR)/debian/ifplugd/lib/udev/ifplugd.agent
        install -m 755 debian/ifplugd.action 
$(CURDIR)/debian/ifplugd/etc/ifplugd/
        install -m 755 debian/ifupdown.action 
$(CURDIR)/debian/ifplugd/etc/ifplugd/action.d/ifupdown
+       install -m 755 debian/wpa_roam.action 
$(CURDIR)/debian/ifplugd/etc/ifplugd/action.d/action_wpa_roam
        install -m 755 debian/apm/ifplugd 
$(CURDIR)/debian/ifplugd/etc/apm/scripts.d/
        install -m 755 debian/ifstatus $(CURDIR)/debian/ifplugd/usr/sbin/
        install -m 755 debian/bug/script 
$(CURDIR)/debian/ifplugd/usr/share/bug/ifplugd/
--- /dev/null
+++ b/debian/wpa_roam.action
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+CTRL_IFACE_PATH=/var/run/wpa_supplicant
+if [ ! -d "${CTRL_IFACE_PATH}" ] || [ ! -x /sbin/wpa_action ]; then
+       exit 0
+fi
+
+case "${2}" in
+       up)
+               COMMAND=disconnect
+               ;;
+       down)
+               COMMAND=reconnect
+               ;;
+       *)
+               exit 1
+               ;;
+esac
+
+for CTRL in ${CTRL_IFACE_PATH}/*; do
+       if [ ! -S "${CTRL}" ]; then
+               continue
+       fi
+
+       IFACE="${CTRL##*/}"
+       if [ "${1}" = "${IFACE}" ]; then
+               continue
+       fi
+
+       wpa_action "${IFACE}" check
+       if [ "${?}" -ne 0 ]; then
+               continue
+       fi
+
+       wpa_cli -p "${CTRL_IFACE_PATH}" -i "${IFACE}" "${COMMAND}"
+done
---

-- Package-specific info:
 /proc/net/dev interfaces:
    lo
  eth0
wmaster0
 wlan0

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-9.slh.1-sidux-amd64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ifplugd depends on:
ii  debconf [debconf-2.0]         1.5.22     Debian configuration management sy
ii  libc6                         2.7-12     GNU C Library: Shared libraries
ii  libdaemon0                    0.12-2     lightweight C library for daemons 

Versions of packages ifplugd recommends:
ii  ifupdown                      0.6.8+nmu1 high level tools to configure netw

-- debconf information:
  ifplugd/interfaces:
  ifplugd/hotplug_interfaces:
  ifplugd/args: -q -f -u0 -d10 -w -I
  ifplugd/suspend_action: stop



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to