make pppoe work automatically
[openwrt.git] / package / ppp / ipkg / ppp-pppoe-plugin / etc / init.d / S50pppoe
1 #!/bin/sh
2
3 . /etc/functions.sh
4
5 WAN_PROTO=$(nvram get wan_proto)
6 [ "$WAN_PROTO" = "pppoe" ] || exit 0
7
8 for module in slhc ppp_generic pppox pppoe; do
9 insmod $module 2>/dev/null >/dev/null
10 done
11
12 IFNAME=$(nvram get pppoe_ifname)
13 USERNAME=$(nvram get ppp_username)
14 PASSWORD=$(nvram get ppp_passwd)
15 REDIAL=$(nvram get ppp_redialperiod)
16 REDIAL=${REDIAL:+holdoff $REDIAL}
17 IDLETIME=$(nvram get ppp_idletime)
18 IDLETIME=${IDLETIME:+idle $IDLETIME}
19 MTU=$(nvram get ppp_mtu)
20
21 ifconfig $IFNAME up
22 echo -e "plugin /usr/lib/pppd/rp-pppoe/rp-pppoe.so\nconnect /bin/true\nusepeerdns\ndefaultroute\nuser \"$USERNAME\"\npassword \"$PASSWORD\"\nmtu $MTU\n$IDLETIME\n$REDIAL" > /tmp/.pppoe-data
23 /usr/sbin/pppd file /tmp/.pppoe-data $IFNAME
This page took 0.049825 seconds and 5 git commands to generate.