Lines 101-106
Link Here
|
101 |
# |
101 |
# |
102 |
# Returns 0 (true) when successful, otherwise 1 |
102 |
# Returns 0 (true) when successful, otherwise 1 |
103 |
pppd_start() { |
103 |
pppd_start() { |
|
|
104 |
${IN_BACKGROUND} && return 0 |
105 |
|
104 |
local iface="$1" ifvar=$( bash_variable "$1" ) opts="" link |
106 |
local iface="$1" ifvar=$( bash_variable "$1" ) opts="" link |
105 |
if [[ ${iface%%[0-9]*} != "ppp" ]]; then |
107 |
if [[ ${iface%%[0-9]*} != "ppp" ]]; then |
106 |
eerror "PPP can only be invoked from net.ppp[0-9]" |
108 |
eerror "PPP can only be invoked from net.ppp[0-9]" |
Lines 142-149
Link Here
|
142 |
# Load any commandline options |
144 |
# Load any commandline options |
143 |
eval opts=\"\$\{pppd_${ifvar}\[@\]}\" |
145 |
eval opts=\"\$\{pppd_${ifvar}\[@\]}\" |
144 |
|
146 |
|
145 |
# We don't work if unit, no detach or linkname is set. |
147 |
# We don't work with these options set by the user |
146 |
for i in unit nodetach linkname ; do |
148 |
for i in unit nodetach linkname maxfail persist ; do |
147 |
if [[ " ${opts} " == *" ${i} "* ]]; then |
149 |
if [[ " ${opts} " == *" ${i} "* ]]; then |
148 |
eerror "The option \"${i}\" is not allowed" |
150 |
eerror "The option \"${i}\" is not allowed" |
149 |
return 1 |
151 |
return 1 |
Lines 228-239
Link Here
|
228 |
[[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" |
230 |
[[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" |
229 |
|
231 |
|
230 |
ebegin "Running pppd" |
232 |
ebegin "Running pppd" |
|
|
233 |
[[ " ${opts} " != *" updetatch "* ]] && mark_service_inactive "net.${iface}" |
231 |
i=$( eval /usr/sbin/pppd ${opts} 2>&1 ) |
234 |
i=$( eval /usr/sbin/pppd ${opts} 2>&1 ) |
232 |
eend $? "${i}" || return 1 |
235 |
eend $? "${i}" || return 1 |
233 |
|
236 |
|
234 |
if [[ " ${opts} " == *" updetach "* ]]; then |
237 |
if [[ " ${opts} " == *" updetach "* ]]; then |
235 |
local addr=$( interface_get_address "${iface}" ) |
238 |
local addr=$( interface_get_address "${iface}" ) |
236 |
einfo "${iface} received address ${addr}" |
239 |
einfo "${iface} received address ${addr}" |
|
|
240 |
else |
241 |
einfo "Backgrounding ..." |
242 |
exit 0 |
237 |
fi |
243 |
fi |
238 |
} |
244 |
} |
239 |
|
245 |
|
Lines 244-249
Link Here
|
244 |
# Returns 0 (true) if no process to kill or it terminates successfully, |
250 |
# Returns 0 (true) if no process to kill or it terminates successfully, |
245 |
# otherwise non-zero (false) |
251 |
# otherwise non-zero (false) |
246 |
pppd_stop() { |
252 |
pppd_stop() { |
|
|
253 |
${IN_BACKGROUND} && return 0 |
247 |
local iface="$1" pidfile="/var/run/ppp-$1.pid" |
254 |
local iface="$1" pidfile="/var/run/ppp-$1.pid" |
248 |
|
255 |
|
249 |
[[ ! -s ${pidfile} ]] && return 0 |
256 |
[[ ! -s ${pidfile} ]] && return 0 |