@@ -743,21 +743,27 @@ if [ -n "$CI" ]; then
743743 adb shell " start ranchu-net" 2> /dev/null || true
744744 sleep 5
745745
746- # Bring up eth0 interface (emulator's primary network interface)
747- print_info " Bringing up eth0 network interface ..."
748- adb shell " ip link set eth0 up " 2> /dev/null || true
749- adb shell " ifconfig eth0 up " 2> /dev/null || true
750- sleep 3
746+ # Disable wlan0 to avoid routing conflicts
747+ print_info " Disabling wlan0 to prevent routing conflicts ..."
748+ adb shell " svc wifi disable " 2> /dev/null || true
749+ adb shell " ip link set wlan0 down " 2> /dev/null || true
750+ sleep 2
751751
752- # Configure static IP for eth0 (emulator standard network)
753- print_info " Configuring static IP on eth0..."
754- adb shell " ifconfig eth0 10.0.2.16 netmask 255.255.255.0 up" 2> /dev/null || true
755- adb shell " ip addr add 10.0.2.16/24 dev eth0" 2> /dev/null || true
752+ # Ensure eth0 is up
753+ print_info " Ensuring eth0 interface is up..."
754+ adb shell " ip link set eth0 up" 2> /dev/null || true
756755 sleep 2
757756
758- # Set default route via emulator gateway
759- print_info " Setting default route..."
760- adb shell " ip route add default via 10.0.2.2 dev eth0" 2> /dev/null || true
757+ # Check current route table and add default route if missing
758+ print_info " Checking and fixing routing table..."
759+ if ! adb shell " ip route show" 2> /dev/null | grep -q " default" ; then
760+ print_info " No default route found, adding..."
761+ adb shell " ip route add default via 10.0.2.2 dev eth0" 2> /dev/null || true
762+ else
763+ print_info " Default route exists, replacing to use eth0..."
764+ adb shell " ip route del default" 2> /dev/null || true
765+ adb shell " ip route add default via 10.0.2.2 dev eth0" 2> /dev/null || true
766+ fi
761767 sleep 2
762768
763769 # Check and log network interfaces
0 commit comments