Prevent "SIOCSIFHWADDR: Device or resource busy" when trying to change mac address
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 17 Nov 2008 10:47:02 +0000 (10:47 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 17 Nov 2008 10:47:02 +0000 (10:47 +0000)
SVN-Revision: 13258

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

index 9e7cff99a3e862c32b6ed547e03e9420779da374..9b4320507dddad05b7295dc32552fab297b06010 100755 (executable)
@@ -232,6 +232,7 @@ setup_interface() {
        config_get mtu "$config" mtu
        config_get macaddr "$config" macaddr
        grep "$iface:" /proc/net/dev > /dev/null && \
        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"
 
                $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
        set_interface_ifname "$config" "$iface"