diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-06-11 20:07:46 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-06-11 20:07:46 +0000 |
commit | f01263c0a03c53c3e8ffd89120f38dd36fc52f77 (patch) | |
tree | 28df53031ba722ec8b05b3bb34e91f04a59812c9 /package/ppp/files | |
parent | 4cd76147156752d0389d20aab6aa666af3ec9a82 (diff) | |
download | upstream-f01263c0a03c53c3e8ffd89120f38dd36fc52f77.tar.gz upstream-f01263c0a03c53c3e8ffd89120f38dd36fc52f77.tar.bz2 upstream-f01263c0a03c53c3e8ffd89120f38dd36fc52f77.zip |
[package] 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
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32197 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/ppp/files')
-rwxr-xr-x | package/ppp/files/ppp.sh | 49 |
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 } |