1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-11 23:25:55 +02:00
openwrt-xburst/package/base-files/files/sbin/ifup
jow 4e88a660b0 [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
2011-07-22 00:21:20 +00:00

52 lines
978 B
Bash
Executable File

#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org
/sbin/ifdown "$@"
. /etc/functions.sh
[ $# = 0 ] && { echo " $0 <group>"; exit; }
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
}
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
config_get ifname "$1" device
for dev in ${ifname:-$1}; do
setup_interface "$dev" "$1"
done