diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2013-05-21 10:38:40 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-24 14:14:43 +0100 |
commit | 4462df6a515300c37370c18772bdbbe1c4cf1c17 (patch) | |
tree | de8f1c61cae2713a63e83dde2879fb1425d22baa | |
parent | 40bc4ed3e5a059e1a989a54fc664385d12862e48 (diff) | |
download | poky-4462df6a515300c37370c18772bdbbe1c4cf1c17.tar.gz |
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 <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/runqemu-ifup | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup index 8948153d5a..5f6a437cd7 100755 --- a/scripts/runqemu-ifup +++ b/scripts/runqemu-ifup | |||
@@ -80,16 +80,6 @@ if [ ! -x "$IFCONFIG" ]; then | |||
80 | exit 1 | 80 | exit 1 |
81 | fi | 81 | fi |
82 | 82 | ||
83 | ROUTE=`which route` | ||
84 | if [ "x$ROUTE" = "x" ]; then | ||
85 | # better than nothing... | ||
86 | ROUTE=/sbin/route | ||
87 | fi | ||
88 | if [ ! -x "$ROUTE" ]; then | ||
89 | echo "$ROUTE cannot be executed" | ||
90 | exit 1 | ||
91 | fi | ||
92 | |||
93 | IPTABLES=`which iptables 2> /dev/null` | 83 | IPTABLES=`which iptables 2> /dev/null` |
94 | if [ "x$IPTABLES" = "x" ]; then | 84 | if [ "x$IPTABLES" = "x" ]; then |
95 | IPTABLES=/sbin/iptables | 85 | IPTABLES=/sbin/iptables |
@@ -100,10 +90,11 @@ if [ ! -x "$IPTABLES" ]; then | |||
100 | fi | 90 | fi |
101 | 91 | ||
102 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 92 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] |
103 | $IFCONFIG addr add 192.168.7.$n/32 dev $TAP | 93 | $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP |
94 | $IFCONFIG link set dev $TAP up | ||
104 | 95 | ||
105 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | 96 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] |
106 | $ROUTE add -host 192.168.7.$dest $TAP | 97 | $IFCONFIG route add to 192.168.7.$dest dev $TAP |
107 | 98 | ||
108 | # setup NAT for tap0 interface to have internet access in QEMU | 99 | # setup NAT for tap0 interface to have internet access in QEMU |
109 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 | 100 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 |