remove pppoe init script, add ifup.pppoe for that
[openwrt/svn-archive/archive.git] / openwrt / package / ppp / files / ifup.pppoe
1 #!/bin/sh
2 . /etc/functions.sh
3 IF_NAME=$1
4
5 PROTO=$(nvram get ${IF_NAME}_proto)
6 [ "$PROTO" = "pppoe" ] || exit 0
7
8 for module in slhc ppp_generic pppox pppoe; do
9 /sbin/insmod $module 2>/dev/null >/dev/null
10 done
11
12 (
13 while true; do
14 IFNAME=$(nvram get pppoe_ifname)
15 USERNAME=$(nvram get ppp_username)
16 PASSWORD=$(nvram get ppp_passwd)
17 REDIAL=$(nvram get ppp_redialperiod)
18 REDIAL=${REDIAL:+lcp-echo-interval $REDIAL}
19 IDLETIME=$(nvram get ppp_idletime)
20 IDLETIME=${IDLETIME:+lcp-echo-failure $IDLETIME}
21 MTUV=$(nvram get ppp_mtu)
22 MTU=${MTUV:+mtu $MTUV}
23 MRU=${MTUV:+mru $MTUV}
24
25 ifconfig $IFNAME up
26 echo -e "plugin rp-pppoe.so\nconnect /bin/true\nusepeerdns\ndefaultroute\nuser \"$USERNAME\"\npassword \"$PASSWORD\"\n$MTU\n$MRU\n$IDLETIME\n$REDIAL" > /tmp/.pppoe-data
27 /usr/sbin/pppd nodetach file /tmp/.pppoe-data $IFNAME
28 done
29 ) &