1
0

ifup.pptp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. [ $# = 0 ] && { echo " $0 <group>"; exit; }
  3. . /etc/config/network
  4. type=$1
  5. eval "proto=\"\${${type}_proto}\""
  6. [ "$proto" = "pptp" ] || {
  7. echo "$0: ${type}_proto isn't pptp"
  8. exit
  9. }
  10. mkdir -p /var/lock
  11. for module in slhc ppp_generic ppp_async ip_gre; do
  12. /sbin/insmod $module 2>&- >&-
  13. done
  14. KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5}
  15. case "$ppp_demand" in
  16. on|1|enabled)
  17. DEMAND=${ppp_idletime:+demand idle $ppp_idletime}
  18. [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
  19. ;;
  20. *) DEMAND="persist";;
  21. esac
  22. MTU=${ppp_mtu:-1452}
  23. [ "$pptp_proto" = "static" ] || pptp_proto="dhcp"
  24. do_ifup $pptp_proto $type
  25. /usr/sbin/pppd \
  26. pty "/usr/sbin/pptp $pptp_server_ip --loglevel 0 --nolaunchpppd" \
  27. file /etc/ppp/options.pptp \
  28. connect /bin/true \
  29. usepeerdns \
  30. defaultroute \
  31. replacedefaultroute \
  32. linkname "$type" \
  33. ipparam "$type" \
  34. user "$ppp_username" \
  35. password "$ppp_passwd" \
  36. mtu $MTU mru $MTU \
  37. $DEMAND \
  38. $KEEPALIVE