diff options
Diffstat (limited to 'scripts/poky-qemu-ifup')
-rwxr-xr-x | scripts/poky-qemu-ifup | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/poky-qemu-ifup b/scripts/poky-qemu-ifup index cb1891e271..e7f689d251 100755 --- a/scripts/poky-qemu-ifup +++ b/scripts/poky-qemu-ifup | |||
@@ -17,6 +17,12 @@ | |||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | 19 | ||
20 | USER=$1 | ||
21 | |||
22 | TUNCTL=`which tunctl` | ||
23 | [ "$TUNCTL" = "" ] && TUNCTL=/usr/sbin/tunctl | ||
24 | |||
25 | TAP=`$TUNCTL -b -u $USER` | ||
20 | 26 | ||
21 | IFCONFIG=`which ifconfig` | 27 | IFCONFIG=`which ifconfig` |
22 | if [ "x$IFCONFIG" = "x" ]; then | 28 | if [ "x$IFCONFIG" = "x" ]; then |
@@ -24,7 +30,7 @@ if [ "x$IFCONFIG" = "x" ]; then | |||
24 | IFCONFIG=/sbin/ifconfig | 30 | IFCONFIG=/sbin/ifconfig |
25 | fi | 31 | fi |
26 | 32 | ||
27 | $IFCONFIG tap0 192.168.7.1 | 33 | $IFCONFIG $TAP 192.168.7.1 |
28 | 34 | ||
29 | # setup NAT for tap0 interface to have internet access in QEMU | 35 | # setup NAT for tap0 interface to have internet access in QEMU |
30 | IPTABLES=`which iptables` | 36 | IPTABLES=`which iptables` |
@@ -35,3 +41,5 @@ fi | |||
35 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 | 41 | $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 |
36 | echo 1 > /proc/sys/net/ipv4/ip_forward | 42 | echo 1 > /proc/sys/net/ipv4/ip_forward |
37 | $IPTABLES -P FORWARD ACCEPT | 43 | $IPTABLES -P FORWARD ACCEPT |
44 | |||
45 | echo $TAP | ||