large init script cleanup and merge of whiterussian changes, new dnsmasq config handling
[openwrt.git] / openwrt / package / ppp / files / ifup.pppoe
1 #!/bin/sh
2 [ $# = 0 ] && { echo "  $0 <group>"; exit; }
3 . /etc/config/network
4 type=$1
5
6 eval "proto=\"\${${type}_proto}\""
7 [ "$proto" = "pppoe" ] || {
8         echo "$0: ${type}_proto isn't pppoe"
9         exit
10 }
11
12 for module in slhc ppp_generic pppox pppoe; do
13         /sbin/insmod $module 2>&- >&-
14 done
15
16 eval "IFNAME=\"\${${type}_device}\""
17 KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5}
18 case "$ppp_demand" in
19         on|1|enabled)
20                 DEMAND=${ppp_idletime:+demand idle $ppp_idletime}
21                 [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
22         ;;
23         *) DEMAND="persist";;
24 esac
25 MTU=${ppp_mtu:-1492}
26
27 ifconfig $IFNAME up
28 /usr/sbin/pppd \
29         plugin rp-pppoe.so \
30         connect /bin/true \
31         usepeerdns \
32         defaultroute \
33         linkname $type \
34         ipparam $type \
35         user "$ppp_username" \
36         password "$ppp_passwd" \
37         mtu $MTU mru $MTU \
38         $DEMAND \
39         $KEEPALIVE \
40         nic-$IFNAME
41