fix up the network ifname in the network state when receiving iface/ifup events
[openwrt.git] / package / base-files / files / lib / network / config.sh
index 13e1980..9b43205 100755 (executable)
@@ -90,8 +90,8 @@ prepare_interface() {
        [ "br-$config" = "$iface" -o -e "$iface" ] && return 0;
        
        ifconfig "$iface" 2>/dev/null >/dev/null && {
-               # make sure the interface is removed from any existing bridge and brought down
-               ifconfig "$iface" down
+               # make sure the interface is removed from any existing bridge and deconfigured 
+               ifconfig "$iface" 0.0.0.0
                unbridge "$iface"
        }
 
@@ -120,7 +120,7 @@ prepare_interface() {
                                        $DEBUG brctl setfd "br-$config" 0
                                        $DEBUG ifconfig "br-$config" up
                                        $DEBUG brctl addif "br-$config" "$iface"
-                                       $DEBUG brctl stp "br-$config" ${stp:-off}
+                                       $DEBUG brctl stp "br-$config" ${stp:-0}
                                        # Creating the bridge here will have triggered a hotplug event, which will
                                        # result in another setup_interface() call, so we simply stop processing
                                        # the current event at this point.
@@ -142,6 +142,10 @@ set_interface_ifname() {
        uci_set_state network "$config" device "$device"
 }
 
+setup_interface_none() {
+       env -i ACTION="ifup" INTERFACE="$2" DEVICE="$1" PROTO=none /sbin/hotplug-call "iface" &
+}
+
 setup_interface_static() {
        local iface="$1"
        local config="$2"
@@ -228,6 +232,7 @@ setup_interface() {
        config_get mtu "$config" mtu
        config_get macaddr "$config" macaddr
        grep "$iface:" /proc/net/dev > /dev/null && \
+               $DEBUG ifconfig "$iface" down && \
                $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
        set_interface_ifname "$config" "$iface"
 
@@ -259,6 +264,9 @@ setup_interface() {
                                lock -u "/var/lock/dhcp-$iface"
                        fi
                ;;
+               none)
+                       setup_interface_none "$iface" "$config"
+               ;;
                *)
                        if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then
                                eval "setup_interface_$proto '$iface' '$config' '$proto'" 
This page took 0.028598 seconds and 4 git commands to generate.