From 3068ba84b894b33814fa69d17d79c7755b6c6c76 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 13 Aug 2011 23:20:03 +0000 Subject: [PATCH] [backfire] backport r27720 SVN-Revision: 27977 --- package/base-files/Makefile | 2 +- package/base-files/files/sbin/ifdown | 22 +++++++++------ package/base-files/files/sbin/ifup | 42 +++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index cc6e657989..ff00fb4a87 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:=43.26 +PKG_RELEASE:=43.27 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 "; 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 "; 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 -- 2.30.2