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 # You need to create the PPP net script yourself. Make it like so
#ln -s net.lo /etc/init.d/net.ppp0 #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" # 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="/dev/ttyS0" # Most PPP links will use a serial port
#link_ppp0="eth0" # PPPoE requires an ethernet interface #link_ppp0="eth0" # PPPoE requires an ethernet interface

View File

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