2 route
-n |
awk '$1 == "0.0.0.0" { print $2; exit }'
6 config_set
"$1" device
"pptp-$1"
9 stop_interface_pptp
() {
10 stop_interface_ppp
"$1"
11 for ip
in $
(uci_get_state network
"$1" serv_addrs
); do
12 route del
-host "$ip" 2>/dev
/null
16 coldplug_interface_pptp
() {
17 setup_interface_pptp
"pptp-$1" "$1"
20 setup_interface_pptp
() {
25 config_get device
"$config" device
28 config_get server
"$config" server
31 config_get_bool buffering
"$config" buffering
1
32 [ "$buffering" == 0 ] && buffering
="--nobuffer" || buffering
=
34 for module
in slhc ppp_generic ppp_async ip_gre
; do
35 /sbin
/insmod
$module 2>&- >&-
42 for ip
in $
(resolveip
-4 -t 3 "$server"); do
43 append serv_addrs
"$ip"
44 route delete
-host "$ip" 2>/dev
/null
45 route add
-host "$ip" gw
"$gw"
47 uci_toggle_state network
"$config" serv_addrs
"$serv_addrs"
51 config_get netmask
"$config" netmask
52 [ -z "$netmask" -o -z "$device" ] || ifconfig
$device netmask
$netmask
54 config_get mtu
"$config" mtu
56 start_pppd
"$config" \
57 pty
"/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd $buffering" \
58 file /etc
/ppp
/options.pptp \