From: Laurentiu Palcu Date: Tue, 21 May 2013 07:38:40 +0000 (+0300) Subject: runqemu: fix networking issues X-Git-Tag: rev_ivi_2015_02_04~12442 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08ec67bab9cd7e85afc983c3703c9cc88db4cf4a;p=scm%2Fbb%2Ftizen-distro.git runqemu: fix networking issues After switching from ifconfig to ip, networking stopped working. This commit contains the following fixes: * set a decent broadcast address for the tap device; * bring up the device; * add the route using ip tool instead of the old route tool; (From OE-Core rev: a286514e2311f52b54d3571dbac6d34aff39e591) Signed-off-by: Laurentiu Palcu Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 8948153..5f6a437 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup @@ -80,16 +80,6 @@ if [ ! -x "$IFCONFIG" ]; then exit 1 fi -ROUTE=`which route` -if [ "x$ROUTE" = "x" ]; then - # better than nothing... - ROUTE=/sbin/route -fi -if [ ! -x "$ROUTE" ]; then - echo "$ROUTE cannot be executed" - exit 1 -fi - IPTABLES=`which iptables 2> /dev/null` if [ "x$IPTABLES" = "x" ]; then IPTABLES=/sbin/iptables @@ -100,10 +90,11 @@ if [ ! -x "$IPTABLES" ]; then fi n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] -$IFCONFIG addr add 192.168.7.$n/32 dev $TAP +$IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP +$IFCONFIG link set dev $TAP up dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] -$ROUTE add -host 192.168.7.$dest $TAP +$IFCONFIG route add to 192.168.7.$dest dev $TAP # setup NAT for tap0 interface to have internet access in QEMU $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32