remove duplicate code
[openwrt.git] / openwrt / package / ppp / files / ifup.pppoa
1 #!/bin/sh
2 [ $# = 0 ] && { echo " $0 <group>"; exit; }
3 . /etc/functions.sh
4 . /etc/network.overrides
5 [ -e /etc/config/network ] && . /etc/config/network
6 type=$1
7
8 [ "$(nvram get ${type}_proto)" = "pppoa" ] || {
9 echo "$0: ${type}_proto isn't pppoa"
10 exit
11 }
12
13 for module in slhc ppp_generic pppoatm; do
14 /sbin/insmod $module 2>&- >&-
15 done
16
17 VPI=$(nvram get atm_vpi)
18 VCI=$(nvram get atm_vci)
19 USERNAME=$(nvram get ppp_username)
20 PASSWORD=$(nvram get ppp_passwd)
21 KEEPALIVE=$(nvram get ppp_redialperiod)
22 KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 10 lcp-echo-failure $KEEPALIVE}
23 DEMAND=$(nvram get ppp_demand)
24 case "$DEMAND" in
25 on|1|enabled)
26 DEMAND=$(nvram get ppp_idletime)
27 DEMAND=${IDLETIME:+demand idle $IDLETIME}
28 ;;
29 *) DEMAND="persist";;
30 esac
31 MTU=$(nvram get ppp_mtu)
32 MTU=${MTU:-1500}
33
34 /usr/sbin/pppd \
35 plugin pppoatm.so ${VPI:-8}.${VCI:-35} \
36 usepeerdns \
37 defaultroute \
38 linkname $type \
39 ipparam $type \
40 user "$USERNAME" \
41 password "$PASSWORD" \
42 mtu $MTU mru $MTU \
43 $DEMAND \
44 $KEEPALIVE
This page took 0.042807 seconds and 5 git commands to generate.