>>141 の続き
android-wifi-tether、中身はこのスクリプトを走らせているだけで、
adb shell から root で実行するとMVNOテザリング出来るけれど、
android-wifi-tether のアプリの中からだと動かない。謎。

rmmod dhd
insmod /system/lib/modules/dhd.ko "firmware_path=/system/etc/wifi/bcmdhd_apsta.bin nvram_path=/system/etc/wifi/nvram_net.txt"
/system/bin/ifconfig wlan0 192.168.2.254 netmask 255.255.255.0
/system/bin/hostapd -P /data/data/com.googlecode.android.wifi.tether/var/hostapd.pid \
-B /data/data/com.googlecode.android.wifi.tether/conf/hostapd.conf
/system/bin/ip rule add to 192.168.2.0/24 lookup main priority 50
/system/bin/iptables -N wireless-tether
/system/bin/iptables -F wireless-tether
/system/bin/iptables -F FORWARD
/system/bin/iptables -t nat -F PREROUTING
/system/bin/iptables -t nat -F POSTROUTING
/system/bin/iptables -t nat -F
/system/bin/iptables -A wireless-tether -m state --state ESTABLISHED,RELATED -j ACCEPT
/system/bin/iptables -A wireless-tether -s 192.168.2.0/24 -j ACCEPT
/system/bin/iptables -A wireless-tether -p 47 -j ACCEPT
/system/bin/iptables -A wireless-tether -j DROP
/system/bin/iptables -A FORWARD -m state --state INVALID -j DROP
/system/bin/iptables -A FORWARD -j wireless-tether
/system/bin/iptables -t nat -I POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
/system/bin/dnsmasq -I lo -i wlan0 --dhcp-authoritative --no-negcache --user=root --no-resolv --no-hosts \
--server=8.8.8.8 --server=8.8.4.4 --dhcp-range=192.168.2.100,192.168.2.108,12h \
--dhcp-leasefile=/data/data/com.googlecode.android.wifi.tether/var/dnsmasq.leases \
--pid-file=/data/data/com.googlecode.android.wifi.tether/var/dnsmasq.pid