scripts/poky-qemu-ifup: Ensure the host has a route to it

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Richard Purdie 2010-09-10 10:43:06 +01:00
parent 8e43883f97
commit c4ff5f3038
1 changed files with 9 additions and 0 deletions

View File

@ -92,9 +92,18 @@ if [ "x$IFCONFIG" = "x" ]; then
IFCONFIG=/sbin/ifconfig
fi
ROUTE=`which route`
if [ "x$ROUTE" = "x" ]; then
# better than nothing...
ROUTE=/sbin/route
fi
n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
$IFCONFIG $TAP 192.168.7.$n
dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
$ROUTE add -host 192.168.7.$dest $TAP
# setup NAT for tap0 interface to have internet access in QEMU
IPTABLES=`which iptables`
if [ "x$IPTABLES" = "x" ]; then