prepare_interface() {
local iface="$1"
local config="$2"
+ local vifmac="$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
# make sure the interface is removed from any existing bridge and deconfigured
ifconfig "$iface" 0.0.0.0
unbridge "$iface"
+
+ # Change interface MAC address if requested
+ [ -n "$vifmac" ] && {
+ ifconfig "$iface" down
+ ifconfig "$iface" hw ether "$vifmac" up
+ }
}
# Setup VLAN interfaces
setup_interface() {
local iface="$1"
local config="$2"
+ local vifmac="$4"
local proto
local macaddr
}
proto="${3:-$(config_get "$config" proto)}"
- prepare_interface "$iface" "$config" || return 0
+ prepare_interface "$iface" "$config" "$vifmac" || return 0
[ "$iface" = "br-$config" ] && {
# need to bring up the bridge and wait a second for
# Interface settings
config_get mtu "$config" mtu
config_get macaddr "$config" macaddr
- macaddr="${macaddr:-$3}"
grep "$iface:" /proc/net/dev > /dev/null && \
$DEBUG ifconfig "$iface" down && \
$DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
start_net() {(
local iface="$1"
local config="$2"
+ local vifmac="$3"
[ -f "/var/run/$iface.pid" ] && kill "$(cat /var/run/${iface}.pid)" 2>/dev/null
include /lib/network
scan_interfaces
- setup_interface "$1" "$2" "$3"
+ setup_interface "$iface" "$config" "" "$vifmac"
)}
set_wifi_up() {