From c2322d6eed64984ad8dc4789c38eff98459f4322 Mon Sep 17 00:00:00 2001 From: Varinder Pratap Singh Date: Tue, 31 May 2022 18:03:03 +0530 Subject: [PATCH] Added Robot Bridge support to connect 2 or more emulator. Change-Id: Iaaf91d62ab7b5745ce01cf6c12261655b2268bc9 Signed-off-by: Varinder Pratap Singh --- tizen/src/scripts/emulator-ifup-linux.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tizen/src/scripts/emulator-ifup-linux.sh b/tizen/src/scripts/emulator-ifup-linux.sh index 13a057d..dbff6c5 100755 --- a/tizen/src/scripts/emulator-ifup-linux.sh +++ b/tizen/src/scripts/emulator-ifup-linux.sh @@ -18,7 +18,7 @@ CHECK_BR=`/bin/ls /sys/class/net | grep $BR` if [ "x$CHECK_BR" = "x" ] then echo "$BR does not exist! create it" - BASEIPADDR=`ip addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1` + #BASEIPADDR=`ip addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1` brctl addbr $BR else BASEIPADDR=`ip addr show $BR | awk '/inet / {print $2}' | cut -d/ -f1` @@ -37,6 +37,14 @@ then fi brctl addif $BR $1 +####### +if [ "x$BASEIPADDR" = "x" ] +then + echo "Default BASEIPADDR: 192.168.7.1" + BASEIPADDR=192.168.7.1 +fi +####### + echo "Add the default route." if [ "x$NETMASK" = "x" ];then echo "netmask is NULL" @@ -48,6 +56,16 @@ else fi NET=`netstat -rn | grep ^0.0.0.0 | awk '{print $8}'` echo "NET: $NET" + +############## +sudo iptables -I FORWARD 1 -i $BR -j ACCEPT +sudo iptables -I FORWARD 1 -o $BR -j ACCEPT +sudo iptables -I INPUT 1 -i $BR -j ACCEPT +sudo iptables -I OUTPUT 1 -o $BR -j ACCEPT +sudo iptables -A FORWARD -o $NET -j ACCEPT +sudo iptables -t nat -A POSTROUTING -o $NET -j MASQUERADE +############# + if [ "$NET" != "$BR" ] then echo "route add default gw $GW" -- 2.7.4