diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2015-10-22 13:39:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-27 07:24:28 +0000 |
commit | 835525c8bb79007b262b10e9f473ebfa1e4c8ceb (patch) | |
tree | eddddca9bbd2ca3d13fcb6f9f183be0e9517e138 /scripts | |
parent | b13c0be4b0e7cd403d8dc50c10ac6aa215b5fc50 (diff) | |
download | poky-835525c8bb79007b262b10e9f473ebfa1e4c8ceb.tar.gz |
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 <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu-ifup | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index b5a3db964b..d9bd894123 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup | |||
@@ -91,10 +91,25 @@ fi | |||
91 | 91 | ||
92 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 92 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] |
93 | $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP | 93 | $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP |
94 | STATUS=$? | ||
95 | if [ $STATUS -ne 0 ]; then | ||
96 | echo "Failed to set up IP addressing on $TAP" | ||
97 | exit 1 | ||
98 | fi | ||
94 | $IFCONFIG link set dev $TAP up | 99 | $IFCONFIG link set dev $TAP up |
100 | STATUS=$? | ||
101 | if [ $STATUS -ne 0 ]; then | ||
102 | echo "Failed to bring up $TAP" | ||
103 | exit 1 | ||
104 | fi | ||
95 | 105 | ||
96 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | 106 | dest=$[ (`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 |
108 | STATUS=$? | ||
109 | if [ $STATUS -ne 0 ]; then | ||
110 | echo "Failed to add route to 192.168.7.$dest using $TAP" | ||
111 | exit 1 | ||
112 | fi | ||
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 |