change pppoa default mtu, fix typo in default config
[openwrt.git] / package / pptp / files / ifup.pptp
1 #!/bin/sh
2 . /etc/functions.sh
3 . /etc/nvram.overrides
4 [ -e /etc/config/network ] && . /etc/config/network
5 type=$1
6
7 [ "$(nvram get ${type}_proto)" = "pptp" ] || exit
8
9 [ -d "/var/lock" ] || mkdir -p /var/lock || exit 1
10
11 for module in slhc ppp_generic ppp_async ip_gre; do
12 /sbin/insmod $module 2>&- >&-
13 done
14
15 if=$(nvram get pptp_ifname)
16 ip=$(nvram get ${type}_ipaddr)
17 netmask=$(nvram get ${type}_netmask)
18 [ -z "$ip" -o -z "$if" ] || ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
19
20 while :; do
21 IP=$(nvram get pptp_server_ip)
22 USERNAME=$(nvram get ppp_username)
23 PASSWORD=$(nvram get ppp_passwd)
24 REDIAL=$(nvram get ppp_redialperiod)
25 REDIAL=${REDIAL:+lcp-echo-interval $REDIAL}
26 IDLETIME=$(nvram get ppp_idletime)
27 IDLETIME=${IDLETIME:+lcp-echo-failure $IDLETIME}
28 MTU=$(nvram get ppp_mtu)
29 MTU=${MTU:+ mtu $MTU mru $MTU}
30
31 /usr/sbin/pppd nodetach \
32 pty "/usr/sbin/pptp $IP --loglevel 0 --nolaunchpppd" \
33 file /etc/ppp/options.pptp \
34 connect /bin/true \
35 usepeerdns \
36 defaultroute \
37 linkname $type \
38 user "$USERNAME" \
39 password "$PASSWORD" \
40 $MTU \
41 $IDLETIME \
42 $REDIAL \
43 $IFNAME
44 done &
45
This page took 0.0475640000000001 seconds and 5 git commands to generate.