2005-03-26 01:14:33 +00:00
|
|
|
#!/bin/sh
|
2005-07-15 16:56:23 +00:00
|
|
|
[ $# = 0 ] && { echo " $0 <group>"; exit; }
|
2005-03-26 01:14:33 +00:00
|
|
|
. /etc/functions.sh
|
2005-08-23 12:53:17 +00:00
|
|
|
. /etc/network.overrides
|
2005-07-21 14:02:53 +00:00
|
|
|
[ -e /etc/config/network ] && . /etc/config/network
|
2005-07-15 16:56:23 +00:00
|
|
|
type=$1
|
2005-03-26 01:14:33 +00:00
|
|
|
|
2005-07-15 16:56:23 +00:00
|
|
|
[ "$(nvram get ${type}_proto)" = "pppoe" ] || {
|
|
|
|
echo "$0: ${type}_proto isn't pppoe"
|
|
|
|
exit
|
|
|
|
}
|
2005-03-26 01:14:33 +00:00
|
|
|
|
|
|
|
for module in slhc ppp_generic pppox pppoe; do
|
2005-07-15 16:56:23 +00:00
|
|
|
/sbin/insmod $module 2>&- >&-
|
2005-03-26 01:14:33 +00:00
|
|
|
done
|
|
|
|
|
2005-07-15 16:56:23 +00:00
|
|
|
while :; do
|
2005-11-11 20:51:58 +00:00
|
|
|
IFNAME=$(nvram get pppoe_ifname)
|
|
|
|
USERNAME=$(nvram get ppp_username)
|
|
|
|
PASSWORD=$(nvram get ppp_passwd)
|
|
|
|
KEEPALIVE=$(nvram get ppp_redialperiod)
|
|
|
|
KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 10 lcp-echo-failure $KEEPALIVE}
|
|
|
|
DEMAND=$(nvram get ppp_demand)
|
|
|
|
case "$DEMAND" in
|
|
|
|
on|1|enabled)
|
|
|
|
DEMAND=$(nvram get ppp_idletime)
|
|
|
|
DEMAND=${IDLETIME:+demand idle $IDLETIME}
|
|
|
|
;;
|
|
|
|
*) DEMAND="";;
|
|
|
|
esac
|
|
|
|
MTU=$(nvram get ppp_mtu)
|
|
|
|
MTU=${MTU:-1492}
|
2005-04-02 15:41:31 +00:00
|
|
|
|
2005-11-11 20:51:58 +00:00
|
|
|
ifconfig $IFNAME up
|
|
|
|
/usr/sbin/pppd nodetach \
|
|
|
|
plugin rp-pppoe.so \
|
|
|
|
connect /bin/true \
|
|
|
|
usepeerdns \
|
|
|
|
defaultroute \
|
|
|
|
linkname $type \
|
|
|
|
ipparam $type \
|
|
|
|
user "$USERNAME" \
|
|
|
|
password "$PASSWORD" \
|
|
|
|
mtu $MTU mru $MTU \
|
|
|
|
$DEMAND \
|
|
|
|
$KEEPALIVE \
|
|
|
|
nic-$IFNAME
|
|
|
|
|
|
|
|
# Read settings again (might have changed)
|
|
|
|
[ -e /etc/config/network ] && . /etc/config/network
|
2005-07-15 16:56:23 +00:00
|
|
|
done &
|