[OE-core] [PATCH 2/2] runqemu-ifup: Check if the tap interface is set up correctly

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Thu Oct 22 13:39:20 UTC 2015


From: Mariano Lopez <mariano.lopez at linux.intel.com>

The process to set up a tap interface is as follows:
    - tap interface is created
    - An IP address is assigned to the tap interface
    - The interface is bring up
    - A route is added to the target using the tap
      interface

Of all the previous steps, only the first one is
check if it was sucessful. The status of the others
are ignored and all of them are required to have
basic connectivity in the target.

This patch adds the checks for the rest of the stpes
needed to set up the tap interface.

[YOCTO #8550]

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 scripts/runqemu-ifup | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index b5a3db9..d9bd894 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -91,10 +91,25 @@ fi
 
 n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
 $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
+    echo "Failed to set up IP addressing on $TAP"
+    exit 1
+fi
 $IFCONFIG link set dev $TAP up
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
+    echo "Failed to bring up $TAP"
+    exit 1
+fi
 
 dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
 $IFCONFIG route add to 192.168.7.$dest dev $TAP
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
+    echo "Failed to add route to 192.168.7.$dest using $TAP"
+    exit 1
+fi
 
 # setup NAT for tap0 interface to have internet access in QEMU
 $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
-- 
1.8.4.5




More information about the Openembedded-core mailing list