From ca4e2a0a4dafaced8109ddfd42da727f66c511f1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 1 Jun 2009 18:09:50 +0000 Subject: [PATCH] merge r16266, r16269 to 8.09 SVN-Revision: 16272 --- package/base-files/files/lib/network/config.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh index c797b0614b..9c406a94a6 100755 --- a/package/base-files/files/lib/network/config.sh +++ b/package/base-files/files/lib/network/config.sh @@ -84,6 +84,7 @@ prepare_interface() { local iface="$1" local config="$2" local vifmac="$3" + local proto # 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 @@ -91,9 +92,12 @@ 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 deconfigured - ifconfig "$iface" 0.0.0.0 + config_get proto "$config" proto + + # 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" ] && { @@ -242,9 +246,10 @@ setup_interface() { # Interface settings config_get mtu "$config" mtu config_get macaddr "$config" macaddr - grep "$iface:" /proc/net/dev > /dev/null && \ - $DEBUG ifconfig "$iface" down && \ + grep "$iface:" /proc/net/dev > /dev/null && { + [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up + } set_interface_ifname "$config" "$iface" pidfile="/var/run/$iface.pid" @@ -287,6 +292,11 @@ setup_interface() { fi ;; esac + [ "$proto" = none ] || { + for ifn in `ifconfig | grep "^$iface:" | awk '{print $1}'`; do + ifconfig "$ifn" down + done + } config_set "$config" aliases "" config_set "$config" alias_count 0 config_foreach setup_interface_alias alias "$config" "$iface" -- 2.30.2