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