fix kernel package and kernel modules dependency on it
[openwrt.git] / openwrt / 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 while :; do
14 PPTP_PROTO="$(nvram get pptp_proto)"
15 [ "$PPTP_PROTO" = "static" ] || PPTP_PROTO=""
16 PPTP_PROTO="${PPTP_PROTO:-dhcp}"
17 IP=$(nvram get pptp_server_ip)
18 USERNAME=$(nvram get ppp_username)
19 PASSWORD=$(nvram get ppp_passwd)
20 KEEPALIVE=$(nvram get ppp_redialperiod)
21 KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 10 lcp-echo-failure $KEEPALIVE}
22 DEMAND=$(nvram get ppp_demand)
23 case "$DEMAND" in
24 on|1|enabled)
25 DEMAND=$(nvram get ppp_idletime)
26 DEMAND=${IDLETIME:+demand idle $IDLETIME}
27 ;;
28 *) DEMAND="";;
29 esac
30 MTU=$(nvram get ppp_mtu)
31 MTU=${MTU:-1452}
32
33 do_ifup $PPTP_PROTO $type
34
35 # hack for some buggy ISPs
36 NETMASK=$(nvram get ${type}_netmask)
37 IFNAME=$(nvram get pptp_ifname)
38 [ -z "$NETMASK" -o -z "$IFNAME" ] || ifconfig $IFNAME netmask $NETMASK
39
40 /usr/sbin/pppd nodetach \
41 pty "/usr/sbin/pptp $IP --loglevel 0 --nolaunchpppd" \
42 file /etc/ppp/options.pptp \
43 connect /bin/true \
44 usepeerdns \
45 defaultroute \
46 replacedefaultroute \
47 linkname "$type" \
48 ipparam "$type" \
49 user "$USERNAME" \
50 password "$PASSWORD" \
51 mtu $MTU mru $MTU \
52 $DEMAND \
53 $KEEPALIVE
54 done &
55
This page took 0.047008 seconds and 5 git commands to generate.