Restored mrd6 compilation as "ceilf" dependency is now solved, updated to latest...
[openwrt.git] / package / pptp / files / ifup.pptp
1 #!/bin/sh
2 . /etc/functions.sh
3 type=$1
4
5 [ "$(nvram get ${type}_proto)" = "pptp" ] || exit
6
7 [ -d "/var/lock" ] || mkdir -p /var/lock || exit 1
8
9 for module in slhc ppp_generic ppp_async ip_gre; do
10 /sbin/insmod $module 2>&- >&-
11 done
12
13 PPTP_PROTO="$(nvram get pptp_proto)"
14 [ "$PPTP_PROTO" = "static" ] || PPTP_PROTO=""
15 PPTP_PROTO="${PPTP_PROTO:-dhcp}"
16 IP=$(nvram get pptp_server_ip)
17 USERNAME=$(nvram get ppp_username)
18 PASSWORD=$(nvram get ppp_passwd)
19 KEEPALIVE=$(nvram get ppp_redialperiod)
20 KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 10 lcp-echo-failure $KEEPALIVE}
21 DEMAND=$(nvram get ppp_demand)
22 case "$DEMAND" in
23 on|1|enabled)
24 DEMAND=$(nvram get ppp_idletime)
25 DEMAND=${IDLETIME:+demand idle $IDLETIME}
26 ;;
27 *) DEMAND="persist";;
28 esac
29 MTU=$(nvram get ppp_mtu)
30 MTU=${MTU:-1452}
31
32 do_ifup $PPTP_PROTO $type
33
34 # hack for some buggy ISPs
35 NETMASK=$(nvram get ${type}_netmask)
36 IFNAME=$(nvram get ${type}_device)
37 [ -z "$NETMASK" -o -z "$IFNAME" ] || ifconfig $IFNAME netmask $NETMASK
38
39 /usr/sbin/pppd \
40 pty "/usr/sbin/pptp $IP --loglevel 0 --nolaunchpppd" \
41 file /etc/ppp/options.pptp \
42 connect /bin/true \
43 usepeerdns \
44 defaultroute \
45 replacedefaultroute \
46 linkname "$type" \
47 ipparam "$type" \
48 user "$USERNAME" \
49 password "$PASSWORD" \
50 mtu $MTU mru $MTU \
51 $DEMAND \
52 $KEEPALIVE
53
This page took 0.051473 seconds and 5 git commands to generate.