Package: ifupdown
Version: 0.7~alpha5+really0.6.15
Severity: wishlist
Tags: patch
Hi,
This is a proposal for automatic ifupdown on changing rfkill status.
For this a simple udev rules is used, which calls a wrapper script
getting the network interface name for a specific rfkill device. Then
the wrapper script calls ifupdown with --allow=rfkill for all found
network interfaces.
Adding a "allow-rfkill wlan0" to the interfaces file will result in
fully automatic wlan connect by switching the hardware toggle available
in most modern notebooks.
-- Sebastian
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing'), (100, 'unstable'), (50, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.1.0-rc7-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages ifupdown depends on:
ii libc6 2.13-21
ii lsb-base 3.2-28
ii net-tools 1.60-24.1
ifupdown recommends no packages.
Versions of packages ifupdown suggests:
ii iproute 20110629-1
ii isc-dhcp-client 4.1.1-P1-17
ii ppp 2.4.5-5
-- no debconf information
# run ifupdown for each wlan rfkill change
ACTION=="change", ENV{RFKILL_TYPE}=="wlan", SUBSYSTEM=="rfkill", \
RUN+="/usr/local/sbin/ifupdown-rfkill %S %p $env{RFKILL_STATE}"
#!/bin/sh
CHANGE=$3
SYSFS=$1
DEVICE=$SYSFS$2
if [ -e $DEVICE ] ; then
while [ $DEVICE != $SYSFS ] ; do
DEVICE=`dirname $DEVICE`
if [ -d $DEVICE/net ] ; then
for INTERFACE in $DEVICE/net/* ; do
INTERFACE=`basename $INTERFACE`
case $CHANGE in
"1") /sbin/ifup --allow=rfkill $INTERFACE ;;
"0"|"2") /sbin/ifdown --allow=rfkill $INTERFACE ;;
esac
done
fi
done
fi