aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-07-22 00:21:20 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-07-22 00:21:20 +0000
commiteac5958fa7554062a044be973607e21c27166416 (patch)
tree41099bbdbbbbea0abf86e1718a68a8f7807c4f68
parent247397ca80d05b8a5b7b111ef2a71c6cdfb2fd59 (diff)
downloadmaster-187ad058-eac5958fa7554062a044be973607e21c27166416.tar.gz
master-187ad058-eac5958fa7554062a044be973607e21c27166416.tar.bz2
master-187ad058-eac5958fa7554062a044be973607e21c27166416.zip
[package] base-files: attempt bring up related wifi devices when calling ifup
If a user invoked /sbin/ifup to bring up an interface, the setup used to fail in case of wireless networks tied to a non-bridged interface definition. Likewise, the bringup of "lan" in the default configuration will reinitialize the bridge but do not re-join the wireless network to it, requiring an extra call to /sbin/wifi (which might not be possible anymore due to a severed link if connected wirelessly). The changeset modifies the "ifup" command to search for related wireless devices and call "wifi up" on them if applicable. This way the commands for wireless and non-wireless interfaces are unified from a cli point of view. The "ifup -a" case has not been changed to keep the logic of the /etc/init.d/network boot sequence. This might be changed later. Solves #9763. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27720 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/base-files/Makefile2
-rwxr-xr-xpackage/base-files/files/sbin/ifdown22
-rwxr-xr-xpackage/base-files/files/sbin/ifup42
3 files changed, 49 insertions, 17 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 9cac1f058b..5553c99afb 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=base-files
-PKG_RELEASE:=76
+PKG_RELEASE:=77
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
PKG_BUILD_DEPENDS:=opkg/host
diff --git a/package/base-files/files/sbin/ifdown b/package/base-files/files/sbin/ifdown
index 92cdfd2b02..1455a9de77 100755
--- a/package/base-files/files/sbin/ifdown
+++ b/package/base-files/files/sbin/ifdown
@@ -1,16 +1,20 @@
#!/bin/sh
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
. /etc/functions.sh
[ $# = 0 ] && { echo " $0 <group>"; exit; }
-[ "x$1" = "x-a" ] && {
- [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
- config_cb() {
- [ interface != "$1" -o -z "$2" ] || eval "$0 $2"
- }
- config_load network
- exit
-}
+
+case "$1" in
+ "-a")
+ [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
+ config_cb() {
+ [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
+ }
+ config_load network
+ exit 0
+ ;;
+ "-w") shift ;;
+esac
include /lib/network
scan_interfaces
diff --git a/package/base-files/files/sbin/ifup b/package/base-files/files/sbin/ifup
index 6acd2ed099..5f8d80dc2d 100755
--- a/package/base-files/files/sbin/ifup
+++ b/package/base-files/files/sbin/ifup
@@ -5,14 +5,42 @@
. /etc/functions.sh
[ $# = 0 ] && { echo " $0 <group>"; exit; }
-[ "x$1" = "x-a" ] && {
- [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
- config_cb() {
- [ interface != "$1" -o -z "$2" ] || eval "$0 $2"
+
+setup_wifi=1
+
+case "$1" in
+ "-a")
+ [ -e "/tmp/resolv.conf.auto" ] && rm /tmp/resolv.conf.auto
+ config_cb() {
+ [ interface != "$1" -o -z "$2" ] || eval "$0 -w $2"
+ }
+ config_load network
+ exit 0
+ ;;
+ "-w") setup_wifi=0; shift ;;
+esac
+
+if [ $setup_wifi -gt 0 ] && grep -q config /etc/config/wireless; then
+ find_related_radios() {
+ local wdev wnet
+ config_get wdev "$1" device
+ config_get wnet "$1" network
+
+ if [ -n "$wdev" ] && [ "$wnet" = "$network" ]; then
+ append radio_devs "$wdev" "$N"
+ fi
}
- config_load network
- exit
-}
+
+ local radio_devs
+ local network="$1"
+ config_load wireless
+ config_foreach find_related_radios wifi-iface
+
+ local dev
+ for dev in $(echo "$radio_devs" | sort -u); do
+ /sbin/wifi up "$dev"
+ done
+fi
include /lib/network
scan_interfaces