alterator-net-pptp-0.8/000075500000000000000000000000001117070357400151265ustar00rootroot00000000000000alterator-net-pptp-0.8/Makefile000064400000000000000000000001651117070357400165700ustar00rootroot00000000000000NAME=net-pptp INSTALL=/usr/bin/install all: install: install-module include /usr/share/alterator/build/module.mak alterator-net-pptp-0.8/applications/000075500000000000000000000000001117070357400176145ustar00rootroot00000000000000alterator-net-pptp-0.8/applications/net-pptp.desktop000064400000000000000000000004371117070357400227620ustar00rootroot00000000000000[Desktop Entry] Type=Application Categories=X-Alterator-Network Icon=net-pptp Terminal=false Name=PPTP connections X-Alterator-URI=/net-pptp X-Alterator-Help=net-pptp Name[ru]=PPTP-соединения Name[uk]=PPTP-з'єднання Name[pt_BR]=PPTP conexões Name[es]=PPTP conecciones alterator-net-pptp-0.8/backend3/000075500000000000000000000000001117070357400166005ustar00rootroot00000000000000alterator-net-pptp-0.8/backend3/net-pptp000075500000000000000000000140021117070357400202720ustar00rootroot00000000000000#!/bin/sh -f wait_time=3 alterator_api_version=1 . alterator-sh-functions . alterator-net-functions . alterator-hw-functions # do our best so that $1 is working # FIXME: this should become redundant when etcnet gets fixed # (https://bugzilla.altlinux.org/show_bug.cgi?id=14021) bring_up() { [ -n "$1" ] || return write_debug 'bring_up[%s]\n' "$1" local iface="$(read_iface_option "/etc/net/ifaces/$1" REQUIRES)" # ensure underlying iface is up [ -z "$iface" ] || iface_up "$iface" "$wait_time" # workaround: etcnet might try to bring up ppp too early # when underlying eth is configured via dhcp and is down sleep 1 # try to wait until ppp0 might go down (otherwise # additional static route might not appear) iface_down "$1" "$wait_time" iface_up "$1" "$wait_time" 3>/dev/null } ################### interface modificators ppp0_if_there() { # FIXME: it's a kluge // mike on 20080422 # if ppp0 is dialer-initiated, not static iface (pptp/pppoe) # then echo it too netdev_list|grep -qs ppp0 && [ ! -d /etc/net/ifaces/ppp0 ] && write_enum_item 'ppp0' } read_connection() { local name="/etc/net/ifaces/$1" # mppe is off by default with pppd write_bool_param 'mppe' "$(read_ppp_option1 "$name" 'require-mppe' 'nomppe')" # we prefer it to work by default, at least when already configured # and for just created interfaces ! [ -x "$name/ifup-pre" -a -x "$name/ifdown-post" ] write_bool_param 'save_route' "$?" local SAVE_GW="#t" [ -x "$name/ifup-pre" -a -x "$name/ifdown-post" ] || SAVE_GW="#f" # usually default route needs to be replaced # /etc/ppp/options should hold "replacedeaultroute", # $name/pppoptions should hold "defaultroute" then; see pppd(8) write_bool_param def_via_vpn "$(read_ppp_option1 "$name" 'defaultroute' 'nodefaultroute' 'yes')" write_bool_param persist "$(read_ppp_option1 "$name" 'persist' 'nopersist')" local info= netdev_is_up "$1" && info="`_ "connection established"`" || info="`_ "connection down"`" write_string_param info "$info" write_string_param server "$(read_iface_option "$name" PPTP_SERVER)" write_string_param iface "$(read_iface_option "$name" REQUIRES)" write_string_param login "$(read_ppp_option "$name" user)" write_bool_param onboot "$(read_iface_option "$name" ONBOOT)" } write_save_route() { if test_bool "$in_save_route";then DEF_GW="`/sbin/ip ro | awk '/^default via/ { print $3; exit; }'`" [ -n "$DEF_GW" ] || return [ "$DEF_GW" != "$in_server" ] || return printf "#!/bin/sh\n/sbin/ip route add %s via %s\n" "$in_server" "$DEF_GW" > "$name/ifup-pre" printf "#!/bin/sh\n/sbin/ip route del %s via %s\n" "$in_server" "$DEF_GW" > "$name/ifdown-post" chmod +x "$name/ifup-pre" "$name/ifdown-post" else [ -x "$name/ifdown-post" ] && "$name/ifdown-post" rm -f "$name/ifup-pre" "$name/ifdown-post" fi } write_connection() { [ "$1" = "/" ] && return local name="/etc/net/ifaces/$1" [ "$in_onboot" = "#t" ] && in_onboot="yes" || in_onboot="no" [ -d "$name" ] || mkdir -- "$name" [ -n "$in_server" ] && write_iface_option "$name" PPTP_SERVER "$in_server" # e.g. ppp0 might be a dynamic dial-up interface [ -f "/etc/net/ifaces/$in_iface/options" ] && write_iface_option "$name" REQUIRES "$in_iface" [ -n "$in_iface" ] && write_iface_option "$name" ONBOOT "$in_onboot" [ -n "$in_login" ] && write_ppp_option "$name" user "$in_login" [ -n "$in_password" ] && write_ppp_option "$name" password $(echo "$in_password"|sed -e 's/["]/\\\\&/g') test_bool "$in_mppe" write_ppp_option1 "$name" 'require-mppe' 'nomppe' "$?" test_bool "$in_def_via_vpn" write_ppp_option1 "$name" 'defaultroute' 'nodefaultroute' "$?" test_bool "$in_persist" write_ppp_option1 "$name" 'persist' 'nopersist' "$?" write_save_route [ "$in_onboot" = "yes" ] && bring_up "$1" return 0 } new_connection() { local name="/etc/net/ifaces/$1" mkdir -p -- "$name" write_iface_option "$name" TYPE ppp write_iface_option "$name" PPPTYPE pptp # vsu@ proposed that nodeflate, nobsdcomp be disabled # by default after debugging a problem in community@ # ...and that mtu be clamped at 1460 or 1400 # usepeerdns https://bugzilla.altlinux.org/show_bug.cgi?id=14116 cat>"$name/pppoptions"<


Status:
Server:
Account:
Password:
Walk through interface:
  Default route via VPN
  Save route to VPN gateway
  MPPE encryption
  Redial on hangup
  Start at boot
 
    
alterator-net-pptp-0.8/ui/net-pptp/index.scm000064400000000000000000000057611117070357400211360ustar00rootroot00000000000000(document:surround "/std/frame") ;;; Functions (define (init-iface) (form-update-enum "iface" (woo-list "/net-pptp/avail_iface")) (form-update-enum "status" (woo-list "/net-pptp/avail_state"))) (define (read-current-iface) (read-iface (or (form-value "name") ""))) (define (read-iface name) (catch/message (lambda() (let ((data (woo-read-first "/net-pptp/" 'name name))) (form-update-enum "name" (woo-list "/net-pptp/avail_connection")) (form-update-value "password" "") (form-update-value-list '("name" "new_name" "info" "status" "server" "login" "iface" "def_via_vpn" "save_route" "mppe" "persist" "onboot") data))))) (define (write-iface) (catch/message (lambda() (apply woo-write "/net-pptp" 'commit #t (form-value-list)) (read-iface (form-value "name"))))) (define (new-iface) (catch/message (lambda() (let ((new_name (form-value "new_name"))) (woo-write "/net-pptp" 'new #t 'new_name new_name) (read-iface new_name))))) (define (delete-iface) (catch/message (lambda() (woo-write "/net-pptp/" 'delete #t 'name (or (form-value "name") "")) (read-iface "")))) ;;; UI (edit visibility #f name "new_name") (gridbox columns "100" margin 10 (button text (_ "New connection...") align "left" name "new_button") (separator) (splitbox columns "30;70" (listbox name "name") (gridbox columns "0;100" ;; (label text (_ "Status:") align "right") (hbox align "left" (label name "info") (combobox name "status")) ;; (label text (_ "Server:") align "right" name "server") (edit name "server") ;; (label text (_ "Account:") align "right" name "login") (edit name "login") ;; (label text (_ "Password:") align "right" name "password") (edit echo "stars" name "password") ;; (label text (_ "Walk through interface:") align "right") (combobox name "iface") ;; (spacer) (checkbox text (_ "Default route via VPN") name "def_via_vpn") ;; (spacer) (checkbox text (_ "Save route to VPN gateway") name "save_route") ;; (spacer) (checkbox text (_ "MPPE encryption") name "mppe") ;; (spacer) (checkbox text (_ "Redial on hangup") name "persist") ;; (spacer) (checkbox text (_ "Start at boot") name "onboot") ;; (label colspan 2) ;; (spacer) (hbox align "left" (button text (_ "Apply") name "apply_button") (button text (_ "Reset") name "reset_button") (label text " ") (button text (_ "Delete connection") name "del_button"))))) ;;; Logic (document:root (when loaded (form-bind "new_button" "click" new-iface) (form-bind "del_button" "click" delete-iface) (form-bind "apply_button" "click" write-iface) (form-bind "reset_button" "click" read-current-iface) (form-bind "name" "change" read-current-iface) (init-iface) (read-current-iface)))