aboutsummaryrefslogtreecommitdiffstats
path: root/package/ppp/files/ppp.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-11 20:07:46 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-11 20:07:46 +0000
commit13b8a13d48d065c19078d9a9e348733f9475b7ca (patch)
tree83e3ee55bdbc18b94c4d61882e080457ecc5e898 /package/ppp/files/ppp.sh
parent16a34b222ae9126793bdc215b8e77ed71001d174 (diff)
downloadupstream-13b8a13d48d065c19078d9a9e348733f9475b7ca.tar.gz
upstream-13b8a13d48d065c19078d9a9e348733f9475b7ca.tar.bz2
upstream-13b8a13d48d065c19078d9a9e348733f9475b7ca.zip
ppp: add support for kernel mode pptp - add ppp-mod-pptp, based on patch by Daniel Golle <dgolle@allnet.de> - add netifd integration for pptp to ppp.sh
SVN-Revision: 32197
Diffstat (limited to 'package/ppp/files/ppp.sh')
-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
}