Package: qemu-kvm Version: 0.14.0+dfsg-1~tls Using 2.6.38 it seems that "ip route ls" lists several default route devices, e.g.
10.42.100.0/24 dev br0 proto kernel scope link src 10.42.100.3 10.42.100.0/24 dev eth0 proto kernel scope link src 10.42.100.3 default via 10.42.100.1 dev eth0 default via 10.42.100.1 dev br0 This breaks /etc/kvm/kvm-ifup. eth0 is not a bridge, and br0 is never tried. Attached you can find a better version. Regards Harri
#! /bin/sh # Script to bring a network (tap) device for qemu-kvm up # The idea is to add the tap device to the same bridge # as we have default routing to. switch=$(ip route ls | \ awk '/^default / { for(i=0;i<NF;i++) { if ($i == "dev") { print $(i+1); } } }' ) /sbin/ifconfig $1 0.0.0.0 up # only add the interface to default-route bridge if we # have such interface (with default route) and if that # interface is actually a bridge. for switch in $switch; do if [ -n "$switch" -a -d /sys/class/net/$switch/bridge/. ]; then /usr/sbin/brctl addif $switch $1 || : break fi done
signature.asc
Description: OpenPGP digital signature