append interfaces "$CONFIG_SECTION"
config_get iftype "$CONFIG_SECTION" type
config_get ifname "$CONFIG_SECTION" ifname
append interfaces "$CONFIG_SECTION"
config_get iftype "$CONFIG_SECTION" type
config_get ifname "$CONFIG_SECTION" ifname
# Create the interface, if necessary.
# Return status 0 indicates that the setup_interface() call should continue
# Return status 1 means that everything is set up already.
# Create the interface, if necessary.
# Return status 0 indicates that the setup_interface() call should continue
# Return status 1 means that everything is set up already.
# 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
# the bridge interface wouldn't exist.
# 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
# the bridge interface wouldn't exist.
ifconfig "$iface" 2>/dev/null >/dev/null && {
# make sure the interface is removed from any existing bridge and brought down
ifconfig "$iface" 2>/dev/null >/dev/null && {
# make sure the interface is removed from any existing bridge and brought down
$DEBUG brctl setfd "br-$config" 0
$DEBUG ifconfig "br-$config" up
$DEBUG brctl addif "br-$config" "$iface"
$DEBUG brctl setfd "br-$config" 0
$DEBUG ifconfig "br-$config" up
$DEBUG brctl addif "br-$config" "$iface"
# Creating the bridge here will have triggered a hotplug event, which will
# result in another setup_interface() call, so we simply stop processing
# the current event at this point.
# Creating the bridge here will have triggered a hotplug event, which will
# result in another setup_interface() call, so we simply stop processing
# the current event at this point.
- $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
- uci set "/var/state/network.$config.ifname=$iface"
+ grep "$iface:" /proc/net/dev > /dev/null && \
+ $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
+ set_interface_ifname "$config" "$iface"
pidfile="/var/run/$iface.pid"
case "$proto" in
static)
config_get ipaddr "$config" ipaddr
config_get netmask "$config" netmask
pidfile="/var/run/$iface.pid"
case "$proto" in
static)
config_get ipaddr "$config" ipaddr
config_get netmask "$config" netmask
config_get dns "$config" dns
config_get bcast "$config" broadcast
[ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}"
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"
config_get dns "$config" dns
config_get bcast "$config" broadcast
[ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}"
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"