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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#!/bin/sh
[ "$METHOD" == "ppp" ] || exit 0
[ "$IF_USE_TEMPLATE" ] || exit 0
[ -d /var/lock ] || mkdir /var/lock
[ -f "/etc/ppp/templates/$IF_USE_TEMPLATE" ] || {
logger "$0: requested template '/etc/ppp/templates/$IF_USE_TEMPLATE' not found."
exit 1
}
IDLEOPTIONS="persist\nmaxfail 0"
[ "$IF_PPP_IDLETIME" ] && {
if [ "$IF_PPP_IDLETIME" -gt 0 ]; then
IDLEOTPIONS="idletime $IF_PPP_IDLETIME"
fi
}
[ "$IF_PPP_MTU" ] || IF_PPP_MTU=1412
if [ "$IF_PPP_MTU" -gt 0 ] ; then
NETWORKOPTIONS="mtu $IF_PPP_MTU\nmru $IF_PPP_MTU"
fi
[ "$IF_PPP_VPI" ] || IF_PPP_VPI=1
[ "$IF_PPP_VCI" ] || IF_PPP_VCI=32
REPLACE="
s,#IDLEOPTIONS#,$IDLEOPTIONS,
s,#ENCAPS#,$IF_PPP_ENCAPS,
s,#VPI#,$IF_PPP_VPI,
s,#VCI#,$IF_PPP_VCI,
s,#USERNAME#,$IF_PPP_USERNAME,
s,#PASSWORD#,$IF_PPP_PASSWORD,
s,#DEVICE#,$IF_PPP_DEVICE,
s,#MODEMIP#,$IF_PPP_MODEMIP,
s,#NETWORKOPTIONS#,$NETWORKOPTIONS,
"
sed "$REPLACE" < /etc/ppp/templates/$IF_USE_TEMPLATE > /etc/ppp/peers/$IF_PROVIDER
case "$IF_PPP_DEVICE" in
eth*)
ip link set up dev $IF_PPP_DEVICE
;;
nas*)
[ "$IF_PPP_ENCAPS" ] || encap=0
[ "$IF_PPP_PAYLOAD" ] || payload=1
case "$IF_PPP_PAYLOAD" in
bridged)
payload=1
;;
routed)
payload=0
;;
*)
echo "Wrong payload, use either bridged or routed"
exit 1
;;
esac
case "$IF_PPP_ENCAPS" in
llc)
encap=0
;;
vc)
encap=1
;;
*)
echo "Wrong Encapsulation use either llc or vc"
exit 1
;;
esac
count=$(echo $IF_PPP_DEVICE|sed -e "s/nas//")
br2684ctl -b -c $count -e $encap -p $payload -a $IF_PPP_VPI.$IF_PPP_VCI
ip link set up dev $IF_PPP_DEVICE
;;
esac
case "$IF_USE_TEMPLATE" in
umts)
# wait for card to initialize
COUNT=0
while [ $((COUNT++)) -lt 20 ]; do
[ -c "$IF_PPP_DEVICE" ] && break
[ $COUNT -eq 20 ] && {
logger "$0: '$IF_PPP_DEVICE' not found"
exit 1
}
sleep 1
done
# wait till the SIM is ready
comgt -s /etc/comgt/waitready.comgt -d $IF_PPP_DEVICE || exit 1
# set pincode
if [ "$IF_PIN" ]; then
COMGTPIN="$IF_PIN" comgt PIN -d $IF_PPP_DEVICE || exit 1
fi
# set APN
COMGTAPN="$IF_APN" comgt APN -d $IF_PPP_DEVICE || exit 1
# set umts/gprs mode if available (Option cards only)
case "$IF_MODE" in
gprs_only) comgt 2G -d $IF_PPP_DEVICE ;;
umts_only) comgt 3G -d $IF_PPP_DEVICE ;;
umts_first) comgt 3G2G -d $IF_PPP_DEVICE ;;
"") ;;
*) echo "unknown mode, exiting"
exit 1
;;
esac
;;
esac
|