33143c91584d7e14afcbd69e1b1d39e4fdb6e533
[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 /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:+holdoff $REDIAL}
19 IDLETIME=$(nvram get ppp_idletime)
20 IDLETIME=${IDLETIME:+idle $IDLETIME}
21 MTU=$(nvram get ppp_mtu)
22 MTU=${MTU:+ mtu $MTU mru $MTU}
23
24 ifconfig $IFNAME up
25 echo -e "plugin rp-pppoe.so\npersist\nconnect /bin/true\nusepeerdns\ndefaultroute\nuser \"$USERNAME\"\npassword \"$PASSWORD\"\n$MTU\n$IDLETIME\n$REDIAL" > /tmp/.pppoe-data
26 /usr/sbin/pppd nodetach file /tmp/.pppoe-data $IFNAME
27 done
28 ) &
This page took 0.04547 seconds and 3 git commands to generate.