# Setup bridging
case "$iftype" in
bridge)
- ifconfig "$iface" up 2>/dev/null >/dev/null
- ifconfig "br-$config" 2>/dev/null >/dev/null && {
- $DEBUG brctl addif "br-$config" "$iface"
- return 0
- } || {
- $DEBUG brctl addbr "br-$config"
- $DEBUG brctl setfd "br-$config" 0
- $DEBUG brctl addif "br-$config" "$iface"
- iface="br-$config"
+ [ -x /usr/sbin/brctl ] && {
+ ifconfig "$iface" up 2>/dev/null >/dev/null
+ ifconfig "br-$config" 2>/dev/null >/dev/null && {
+ $DEBUG brctl addif "br-$config" "$iface"
+ return 0
+ } || {
+ $DEBUG brctl addbr "br-$config"
+ $DEBUG brctl setfd "br-$config" 0
+ $DEBUG brctl addif "br-$config" "$iface"
+ iface="br-$config"
+
+ # need to bring up the bridge and wait a second for
+ # it to switch to the 'forwarding' state, otherwise
+ # it will lose its routes...
+ ifconfig "$iface" up
+ sleep 1
+ }
}
;;
esac
config_get gateway "$config" gateway
config_get dns "$config" dns
- $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask"
- $DEBUG ifconfig "$iface" inet6 add "$ip6addr"
+ [ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask"
+ [ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" inet6 add "$ip6addr"
[ -z "$gateway" ] || route add default gw "$gateway"
[ -z "$dns" -o -f /tmp/resolv.conf.auto ] || {
for ns in $dns; do