2005-03-26 03:14:33 +02:00
|
|
|
#!/bin/sh
|
2005-07-15 19:56:23 +03:00
|
|
|
[ $# = 0 ] && { echo " $0 <group>"; exit; }
|
2005-03-26 03:14:33 +02:00
|
|
|
. /etc/functions.sh
|
2005-08-23 15:53:17 +03:00
|
|
|
. /etc/network.overrides
|
2005-07-21 17:02:53 +03:00
|
|
|
[ -e /etc/config/network ] && . /etc/config/network
|
2005-07-15 19:56:23 +03:00
|
|
|
type=$1
|
2005-03-26 03:14:33 +02:00
|
|
|
|
2005-07-15 19:56:23 +03:00
|
|
|
[ "$(nvram get ${type}_proto)" = "pppoe" ] || {
|
|
|
|
echo "$0: ${type}_proto isn't pppoe"
|
|
|
|
exit
|
|
|
|
}
|
2005-03-26 03:14:33 +02:00
|
|
|
|
|
|
|
for module in slhc ppp_generic pppox pppoe; do
|
2005-07-15 19:56:23 +03:00
|
|
|
/sbin/insmod $module 2>&- >&-
|
2005-03-26 03:14:33 +02:00
|
|
|
done
|
|
|
|
|
2006-01-16 05:14:59 +02:00
|
|
|
IFNAME=$(nvram get ${type}_device)
|
2005-11-19 05:17:20 +02:00
|
|
|
USERNAME=$(nvram get ppp_username)
|
|
|
|
PASSWORD=$(nvram get ppp_passwd)
|
|
|
|
KEEPALIVE=$(nvram get ppp_redialperiod)
|
2006-02-08 20:28:21 +02:00
|
|
|
KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 1 lcp-echo-failure $KEEPALIVE}
|
2005-11-19 05:17:20 +02:00
|
|
|
DEMAND=$(nvram get ppp_demand)
|
|
|
|
case "$DEMAND" in
|
|
|
|
on|1|enabled)
|
|
|
|
DEMAND=$(nvram get ppp_idletime)
|
|
|
|
DEMAND=${IDLETIME:+demand idle $IDLETIME}
|
2006-03-18 19:27:20 +02:00
|
|
|
[ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
|
2005-11-19 05:17:20 +02:00
|
|
|
;;
|
|
|
|
*) DEMAND="persist";;
|
|
|
|
esac
|
|
|
|
MTU=$(nvram get ppp_mtu)
|
|
|
|
MTU=${MTU:-1492}
|
|
|
|
|
|
|
|
ifconfig $IFNAME up
|
2005-11-19 16:07:54 +02:00
|
|
|
/usr/sbin/pppd \
|
2005-11-19 05:17:20 +02:00
|
|
|
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
|
2005-04-02 18:41:31 +03:00
|
|
|
|