Still need linkname to get scripts to execute
[xdandroid:rootfs.git] / init.etc / ppp / ip-up-gprs
1 #!/system/bin/sh
2 case $1 in
3     ppp1)
4         /android/bin/iptables --flush;
5         /android/bin/iptables --table nat --flush;
6         /android/bin/iptables --delete-chain;
7         /android/bin/iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE;
8         /android/bin/iptables --append FORWARD --in-interface ppp1 -j ACCEPT;
9         echo 0 > /proc/sys/net/ipv4/ip_forward;
10         echo 1 > /proc/sys/net/ipv4/ip_forward;
11         ;;
12     ppp0)
13         /system/bin/setprop "net.interfaces.defaultroute" "gprs"
14         ;;
15 esac
16
17 # Use interface name if linkname is not available
18 NAME=${LINKNAME:-"$1"}
19
20 /system/bin/setprop "net.$NAME.dns1" "$DNS1"
21 /system/bin/setprop "net.$NAME.dns2" "$DNS2" 
22 /system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL" 
23 /system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE" 
24 /system/bin/setprop "net.dns1" "$DNS1"
25 /system/bin/setprop "net.dns2" "$DNS2"
26 modem_log()
27 {
28         /bin/echo -e "${@}" >> /smodem/ppp.log
29 }
30 modem_log "Connection attempt SUCCESSFUL!"
31 modem_log "Phone IP:  `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f2 | /bin/cut -d' ' -f1`"
32 modem_log "Subnet  :  `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f4 | /bin/cut -d' ' -f1`"
33 modem_log "P-t-P   :  `/bin/ifconfig ppp0 | /bin/grep 'inet addr:' | /bin/cut -d':' -f3 | /bin/cut -d' ' -f1`"
34 modem_log "Done!"