path: root/scripts/runqemu-ifup
diff options
authorMariano Lopez <>2015-10-22 13:39:20 (GMT)
committerRichard Purdie <>2015-10-27 07:24:28 (GMT)
commit835525c8bb79007b262b10e9f473ebfa1e4c8ceb (patch)
treeeddddca9bbd2ca3d13fcb6f9f183be0e9517e138 /scripts/runqemu-ifup
parentb13c0be4b0e7cd403d8dc50c10ac6aa215b5fc50 (diff)
runqemu-ifup: Check if the tap interface is set up correctly
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] (From OE-Core rev: 52f6bacffc517198f0d1f24e5418ee4c9cb5442a) Signed-off-by: Mariano Lopez <> Signed-off-by: Ross Burton <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'scripts/runqemu-ifup')
1 files changed, 15 insertions, 0 deletions
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
91 91
92n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] 92n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
93$IFCONFIG addr add 192.168.7.$n/32 broadcast dev $TAP 93$IFCONFIG addr add 192.168.7.$n/32 broadcast dev $TAP
95if [ $STATUS -ne 0 ]; then
96 echo "Failed to set up IP addressing on $TAP"
97 exit 1
94$IFCONFIG link set dev $TAP up 99$IFCONFIG link set dev $TAP up
101if [ $STATUS -ne 0 ]; then
102 echo "Failed to bring up $TAP"
103 exit 1
95 105
96dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] 106dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
97$IFCONFIG route add to 192.168.7.$dest dev $TAP 107$IFCONFIG route add to 192.168.7.$dest dev $TAP
109if [ $STATUS -ne 0 ]; then
110 echo "Failed to add route to 192.168.7.$dest using $TAP"
111 exit 1
98 113
99# setup NAT for tap0 interface to have internet access in QEMU 114# setup NAT for tap0 interface to have internet access in QEMU
100$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 115$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32