mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-22 10:01:03 +00:00
network: do not unnecessarily touch interfaces configured as proto=none; bring down old aliases before setting up new ones
SVN-Revision: 16266
This commit is contained in:
parent
7d3cd06b94
commit
154ebf9380
@ -84,6 +84,7 @@ prepare_interface() {
|
|||||||
local iface="$1"
|
local iface="$1"
|
||||||
local config="$2"
|
local config="$2"
|
||||||
local vifmac="$3"
|
local vifmac="$3"
|
||||||
|
local proto
|
||||||
|
|
||||||
# if we're called for the bridge interface itself, don't bother trying
|
# 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
|
# 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;
|
[ "br-$config" = "$iface" -o -e "$iface" ] && return 0;
|
||||||
|
|
||||||
ifconfig "$iface" 2>/dev/null >/dev/null && {
|
ifconfig "$iface" 2>/dev/null >/dev/null && {
|
||||||
# make sure the interface is removed from any existing bridge and deconfigured
|
config_get proto "$config" proto
|
||||||
ifconfig "$iface" 0.0.0.0
|
|
||||||
|
# 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"
|
unbridge "$iface"
|
||||||
|
[ "$proto" = none ] || ifconfig "$iface" 0.0.0.0
|
||||||
|
|
||||||
# Change interface MAC address if requested
|
# Change interface MAC address if requested
|
||||||
[ -n "$vifmac" ] && {
|
[ -n "$vifmac" ] && {
|
||||||
@ -287,6 +291,11 @@ setup_interface() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
[ "$proto" = none ] || {
|
||||||
|
for ifn in `ifconfig | grep "^$iface:" | awk '{print $1}'`; do
|
||||||
|
ifconfig "$ifn" down
|
||||||
|
done
|
||||||
|
}
|
||||||
config_set "$config" aliases ""
|
config_set "$config" aliases ""
|
||||||
config_set "$config" alias_count 0
|
config_set "$config" alias_count 0
|
||||||
config_foreach setup_interface_alias alias "$config" "$iface"
|
config_foreach setup_interface_alias alias "$config" "$iface"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user