/
init.vsnet
executable file
·42 lines (34 loc) · 1.17 KB
/
init.vsnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/system/bin/sh
cid=$1
cmd=$2
ifaceid=$(($cid-1))
VSNET_IP=`/system/bin/getprop net.pdp$cid.ip`
IFNAME=`/system/bin/getprop net.pdp$cid.name`
case "$cmd" in
down)
/system/bin/log -t rmnet "Stopping $IFNAME($VSNET_IP) for cid=$cid"
/system/bin/ifconfig $IFNAME down || {
/system/bin/log -t rmnet "ERROR: ifconfig unable to down $IFNAME interface";
/system/bin/setprop "net.pdp$cid.svc_down_done" "0";
exit 1;
}
/system/bin/log -t rmnet "$IFNAME is down successfully";
/system/bin/setprop "net.$IFNAME.local-ip" ""
/system/bin/setprop "net.$IFNAME.remote-ip" ""
/system/bin/setprop "net.pdp$cid.svc_down_done" "1"
;;
*)
/system/bin/log -t rmnet "Starting $IFNAME($VSNET_IP) for cid=$cid"
ifconfig $IFNAME $VSNET_IP || {
/system/bin/log -t rmnet "ifconfig for $IFNAME failed";
/system/bin/setprop "net.pdp$cid.svc_done" "0";
exit 1;
}
route add default dev $IFNAME
/system/bin/log -t rmnet "ifconfig for $IFNAME finished successfully";
/system/bin/setprop "net.$IFNAME.local-ip" $VSNET_IP
/system/bin/setprop "net.$IFNAME.remote-ip" $VSNET_IP
/system/bin/setprop net.interfaces.defaultroute gprs
/system/bin/setprop "net.pdp$cid.svc_done" "1"
;;
esac