[Feature][T108][WIFI][task-view-1467]Add WiFi to automatically assign an ip network segment at 192.168.15.*

Only Configure: No
Affected branch: GSW_V1453
Affected module: WIFI
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no

Change-Id: I51a02d92cbab28dfa8ee7ad31b3f49c6c17cd49f
diff --git a/mbtk/rootfs/etc/mbtk_wifi.sh b/mbtk/rootfs/etc/mbtk_wifi.sh
index c208c7e..322635f 100755
--- a/mbtk/rootfs/etc/mbtk_wifi.sh
+++ b/mbtk/rootfs/etc/mbtk_wifi.sh
@@ -83,12 +83,31 @@
 	fi
 }
 
+function add_wlan0_to_bridge {
+    num=1
+    while [ $num -le 10 ]; do
+        if brctl show | grep -q 'br-lan'; then
+            # 判断 wlan0 是否已在 br-lan 中
+            if brctl show | grep -q 'wlan0'; then
+                return 0
+            else
+                brctl addif br-lan wlan0
+                return 0
+            fi
+        fi
+        sleep 1
+        ((num++))
+    done
+    return 1
+}
+
 function wifi_ap_start()
 {
 	hostapd -B /etc/wifi/hostapd.conf
 	sleep 5s
 	
-	brctl addif br-lan wlan0
+	#brctl addif br-lan wlan0
+	add_wlan0_to_bridge
 	iptables -t nat -A POSTROUTING -o ccinet0 -j MASQUERADE --random
 }