aboutsummaryrefslogtreecommitdiffstats
path: root/package/ppp/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/ppp/files')
-rwxr-xr-xpackage/ppp/files/ppp.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh
index 98099dba54..5016be850d 100755
--- a/package/ppp/files/ppp.sh
+++ b/package/ppp/files/ppp.sh
@@ -166,9 +166,58 @@ proto_pppoa_teardown() {
ppp_generic_teardown "$@"
}
+proto_pptp_init_config() {
+ ppp_generic_init_config
+ proto_config_add_string "server"
+ proto_config_add_boolean "buffering"
+ available=1
+ no_device=1
+}
+
+proto_pptp_setup() {
+ local config="$1"
+ local iface="$2"
+
+ local ip serv_addr server
+ json_get_var server server && {
+ for ip in $(resolveip -t 5 "$server"); do
+ ( proto_add_host_dependency "$config" "$ip" )
+ serv_addr=1
+ done
+ }
+ [ -n "$serv_addr" ] || {
+ echo "Could not resolve server address"
+ sleep 5
+ proto_setup_failed "$config"
+ exit 1
+ }
+
+ local buffering
+ json_get_var buffering buffering
+ [ "${buffering:-1}" == 0 ] && buffering="--nobuffer" || buffering=
+
+ local load
+ for module in slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp; do
+ grep -q "$module" /proc/modules && continue
+ /sbin/insmod $module 2>&- >&-
+ load=1
+ done
+ [ "$load" = "1" ] && sleep 1
+
+ ppp_generic_setup "$config" \
+ plugin pptp.so \
+ pptp_server $server \
+ file /etc/ppp/options.pptp
+}
+
+proto_pptp_teardown() {
+ ppp_generic_teardown "$@"
+}
+
[ -n "$INCLUDE_ONLY" ] || {
add_protocol ppp
[ -f /usr/lib/pppd/*/rp-pppoe.so ] && add_protocol pppoe
[ -f /usr/lib/pppd/*/pppoatm.so ] && add_protocol pppoa
+ [ -f /usr/lib/pppd/*/pptp.so ] && add_protocol pptp
}