net: bridge name is flexible
authorMunkyu Im <munkyu.im@samsung.com>
Thu, 24 Sep 2015 08:47:25 +0000 (17:47 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 30 Sep 2015 05:54:14 +0000 (14:54 +0900)
qemu set bridged network on mac os 10.8.
bridge name was fixed with "bridge0".
However from mac os 10.9, the setting is possible on
host network configuration. So, support another bridge names.

Change-Id: I6c75766ca624847cf5e11a5ff9f61afbe89f041f
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/scripts/emulator-ifup-darwin.sh

index d199e71f18d6f536eb5cc35cc7bc12d707f49dbd..c4a2bd6f5337735304b10f2acb0198621a0f2885 100755 (executable)
@@ -1,18 +1,29 @@
 #!/bin/sh -x
-BRIDGE=bridge1
+#$1 = tap name (e.g. tap0)
+#$2 = bridge name (optional)
 TAP=$1
-BASE=en0
 echo "TAP: $1"
+
+BRIDGE=""
+if [ x"$2" != x ]; then
+    echo "BRIDGE=$2"
+    BRIDGE=$2
+else
+    echo "BRIDGE=bridge1"
+    BRIDGE=bridge1
+fi
+
+BASE=en0
 echo "get base network information"
 IP=`ipconfig getifaddr $BASE`
 NETMASK=`ifconfig $BASE | grep "inet " | awk '{print $4}'`
-GW=`netstat -rn | grep ^default | awk '{print $2}'`
+GW=`netstat -rn | grep $BRIDGE | grep ^default | awk '{print $2}'`
 echo "IP: $IP"
 echo "NETMASK: $NETMASK"
 echo "GW: $GW"
 
 echo "create bridge interface"
-CHECK_BR=`ifconfig | grep ^bridge1:`
+CHECK_BR=`ifconfig | grep ^$BRIDGE:`
 echo "CHECK_BR: $CHECK_BR"
 if [ "$CHECK_BR" = "" ]
 then