Patchwork [1/1] runqemu-ifup: enable ip masquerading for QEMU NAT addresses

login
register
mail settings
Submitter Scott Garman
Date April 25, 2012, 12:11 a.m.
Message ID <49762500156a52102418293f3fe167b21e252d8a.1335312509.git.scott.a.garman@intel.com>
Download mbox | patch
Permalink /patch/26395/
State Accepted
Commit 14c4ce77b5c3738a8a9ea7d724de7ce9efff18c4
Headers show

Comments

Scott Garman - April 25, 2012, 12:11 a.m.
Fix the IP masquerading settings so that networked QEMU sessions can
reach external networks.

This is a partial fix for [YOCTO #2329].

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/runqemu-ifup |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Saul Wold - April 27, 2012, 8:55 p.m.
On 04/24/2012 05:11 PM, Scott Garman wrote:
> Fix the IP masquerading settings so that networked QEMU sessions can
> reach external networks.
>
> This is a partial fix for [YOCTO #2329].
>
> Signed-off-by: Scott Garman<scott.a.garman@intel.com>
> ---
>   scripts/runqemu-ifup |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
> index 3bd9980..f80538f 100755
> --- a/scripts/runqemu-ifup
> +++ b/scripts/runqemu-ifup
> @@ -100,7 +100,8 @@ dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
>   $ROUTE add -host 192.168.7.$dest $TAP
>
>   # setup NAT for tap0 interface to have internet access in QEMU
> -$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
> +$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
> +$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
>   echo 1>  /proc/sys/net/ipv4/ip_forward
>   $IPTABLES -P FORWARD ACCEPT
>

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index 3bd9980..f80538f 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -100,7 +100,8 @@  dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
 $ROUTE add -host 192.168.7.$dest $TAP
 
 # setup NAT for tap0 interface to have internet access in QEMU
-$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
 echo 1 > /proc/sys/net/ipv4/ip_forward
 $IPTABLES -P FORWARD ACCEPT