Android pppd doesn't setenv LINKNAME, check the filename
[xdandroid:rootfs.git] / init.etc / ppp / ip-up-gprs
1 #!/system/bin/sh
2
3 # Use yyy of ip-xx-yyy in program name
4 LINK=`echo $0 | cut -d- -f3`
5 NAME=${LINK:-"$LINKNAME"}
6 # Use interface name if linkname is not available
7 NAME=${NAME:-"$1"}
8
9 case $1 in
10     ppp1)
11         /android/bin/iptables --flush;
12         /android/bin/iptables --table nat --flush;
13         /android/bin/iptables --delete-chain;
14         /android/bin/iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE;
15         /android/bin/iptables --append FORWARD --in-interface ppp1 -j ACCEPT;
16         echo 0 > /proc/sys/net/ipv4/ip_forward;
17         echo 1 > /proc/sys/net/ipv4/ip_forward;
18         ;;
19     ppp0)
20         /system/bin/setprop "net.interfaces.defaultroute" "$NAME"
21         ;;
22 esac
23
24 /system/bin/setprop "net.$NAME.dns1" "$DNS1"
25 /system/bin/setprop "net.$NAME.dns2" "$DNS2" 
26 /system/bin/setprop "net.$NAME.local-ip" "$IPLOCAL" 
27 /system/bin/setprop "net.$NAME.remote-ip" "$IPREMOTE" 
28 /system/bin/setprop "net.dns1" "$DNS1"
29 /system/bin/setprop "net.dns2" "$DNS2"