Merge r15042 to 8.09 (part 2 of brcm-2.4 multi-ssid fix)
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 10 Apr 2009 14:08:00 +0000 (14:08 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 10 Apr 2009 14:08:00 +0000 (14:08 +0000)
SVN-Revision: 15204

package/base-files/files/lib/network/config.sh
package/base-files/files/sbin/wifi

index f781f4b737c80a08d12cd4ed9f058c76891b8798..eb1479b7de80cef867bb0a8aec4c192593fd339c 100755 (executable)
@@ -83,6 +83,7 @@ sort_list() {
 prepare_interface() {
        local iface="$1"
        local config="$2"
+       local vifmac="$3"
 
        # if we're called for the bridge interface itself, don't bother trying
        # to create any interfaces here. The scripts have already done that, otherwise
@@ -93,6 +94,12 @@ prepare_interface() {
                # make sure the interface is removed from any existing bridge and deconfigured 
                ifconfig "$iface" 0.0.0.0
                unbridge "$iface"
+
+               # Change interface MAC address if requested
+               [ -n "$vifmac" ] && {
+                       ifconfig "$iface" down
+                       ifconfig "$iface" hw ether "$vifmac" up
+               }
        }
 
        # Setup VLAN interfaces
@@ -209,6 +216,7 @@ setup_interface_alias() {
 setup_interface() {
        local iface="$1"
        local config="$2"
+       local vifmac="$4"
        local proto
        local macaddr
 
@@ -218,7 +226,7 @@ setup_interface() {
        }
        proto="${3:-$(config_get "$config" proto)}"
        
-       prepare_interface "$iface" "$config" || return 0
+       prepare_interface "$iface" "$config" "$vifmac" || return 0
        
        [ "$iface" = "br-$config" ] && {
                # need to bring up the bridge and wait a second for 
@@ -231,7 +239,6 @@ setup_interface() {
        # Interface settings
        config_get mtu "$config" mtu
        config_get macaddr "$config" macaddr
-       macaddr="${macaddr:-$3}"
        grep "$iface:" /proc/net/dev > /dev/null && \
                $DEBUG ifconfig "$iface" down && \
                $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
index 30ecb1b77c748d141b79105662a776a2fb916cc7..e0aca6315537a815d5094a2b09287500136333ac 100755 (executable)
@@ -66,11 +66,12 @@ wifi_detect() {
 start_net() {(
        local iface="$1"
        local config="$2"
+       local vifmac="$3"
 
        [ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
        include /lib/network
        scan_interfaces
-       setup_interface "$1" "$2" "$3"
+       setup_interface "$iface" "$config" "" "$vifmac"
 )}
 
 set_wifi_up() {