As pppd is mainly a link controller, move it's startup to pppd_pre_start and have pppd_start as a dummy function for old configs.

This commit is contained in:
Roy Marples 2007-04-19 10:52:37 +00:00
parent 2fc28414fa
commit c2407df288
2 changed files with 15 additions and 17 deletions

View File

@ -622,9 +622,6 @@
# You need to create the PPP net script yourself. Make it like so
#ln -s net.lo /etc/init.d/net.ppp0
#
# We have to instruct ppp0 to actually use ppp
#config_ppp0="ppp"
#
# Each PPP interface requires an interface to use as a "Link"
#link_ppp0="/dev/ttyS0" # Most PPP links will use a serial port
#link_ppp0="eth0" # PPPoE requires an ethernet interface

View File

@ -16,29 +16,20 @@ requote() {
printf "'%s' " "$@"
}
pppd_start() {
pppd_pre_start() {
${IN_BACKGROUND} && return 0
if [ "${IFACE%%[0-9]*}" != "ppp" ] ; then
eerror "PPP can only be invoked from net.ppp[0-9]"
return 1
fi
# Interface has to be called ppp
[ "${IFACE%%[0-9]*}" = "ppp" ] || return 0
local link= i= opts= unit="${IFACE#ppp}" mtu=
if [ -z "${unit}" ] ; then
eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
return 1
fi
# PPP requires a link to communicate over - normally a serial port
# PPPoE communicates over Ethernet
# PPPoA communicates over ATM
# In all cases, the link needs to be available before we start PPP
eval link=\$link_${IFVAR}
if [ -z "${link}" ] ; then
eerror "link_${IFVAR} has not been set in /etc/conf.d/net"
return 1
fi
[ -n "${link}" ] || return 0
case "${link}" in
/*)
@ -50,6 +41,11 @@ pppd_start() {
;;
esac
if [ -z "${unit}" ] ; then
eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
return 1
fi
eval $(_get_array "pppd_${IFVAR}")
opts="$@"
@ -199,6 +195,11 @@ pppd_start() {
exit 0
}
# Dummy function for users that still have config_ppp0="ppp"
pppd_start() {
return 0
}
pppd_stop() {
${IN_BACKGROUND} && return 0
local pidfile="/var/run/ppp-${IFACE}.pid"