diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-09-24 20:34:17 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-09-24 20:34:17 +0000 |
commit | 288fa08d0ffdf9c0378a2c1d8fa8b34428b0f856 (patch) | |
tree | dd787ea01a55eebc1c42514bc244c55511862088 /package/base-files/files/lib/network | |
parent | dd728ca937e4140fb0714dd014ba23a32c75d21b (diff) | |
download | master-187ad058-288fa08d0ffdf9c0378a2c1d8fa8b34428b0f856.tar.gz master-187ad058-288fa08d0ffdf9c0378a2c1d8fa8b34428b0f856.tar.bz2 master-187ad058-288fa08d0ffdf9c0378a2c1d8fa8b34428b0f856.zip |
base-files: apply network interface settings such as macaddr, mtu and txqueuelen in prepare_interface instead of setup_interface. setting the mtu after the interface is up is unreliable on some drivers such as gianfar
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28297 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/lib/network')
-rwxr-xr-x | package/base-files/files/lib/network/config.sh | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh index 00e372a1f3..ce8ec89eae 100755 --- a/package/base-files/files/lib/network/config.sh +++ b/package/base-files/files/lib/network/config.sh @@ -152,7 +152,7 @@ sort_list() { prepare_interface() { local iface="$1" local config="$2" - local vifmac="$3" + local macaddr="$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 @@ -166,13 +166,15 @@ prepare_interface() { # make sure the interface is removed from any existing bridge and deconfigured, # (deconfigured only if the interface is not set to proto=none) unbridge "$iface" - [ "$proto" = none ] || ifconfig "$iface" 0.0.0.0 - # Change interface MAC address if requested - [ -n "$vifmac" ] && { - ifconfig "$iface" down - ifconfig "$iface" hw ether "$vifmac" up - } + local mtu macaddr txqueuelen + config_get mtu "$config" mtu + [ -n "$macaddr" ] || config_get macaddr "$config" macaddr + config_get txqueuelen "$config" txqueuelen + [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down + $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up + + [ "$proto" = none ] || ifconfig "$iface" 0.0.0.0 # Apply sysctl settings map_sysctls "$config" "$iface" @@ -350,14 +352,6 @@ setup_interface() { } # Interface settings - grep -qE "^ *$iface:" /proc/net/dev && { - local mtu macaddr txqueuelen - config_get mtu "$config" mtu - config_get macaddr "$config" macaddr - config_get txqueuelen "$config" txqueuelen - [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down - $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up - } set_interface_ifname "$config" "$iface" [ -n "$proto" ] || config_get proto "$config" proto |