Lines 142-149
Link Here
|
142 |
# Load any commandline options |
142 |
# Load any commandline options |
143 |
eval opts=\"\$\{pppd_${ifvar}\[@\]}\" |
143 |
eval opts=\"\$\{pppd_${ifvar}\[@\]}\" |
144 |
|
144 |
|
145 |
# We don't work if nodetach or unit is set |
145 |
# We don't work if unit, no detach or linkname is set. |
146 |
for i in nodetach updetach unit ; do |
146 |
for i in unit nodetach linkname ; do |
147 |
if [[ " ${opts} " == *" ${i} "* ]]; then |
147 |
if [[ " ${opts} " == *" ${i} "* ]]; then |
148 |
eerror "The option \"${i}\" is not allowed" |
148 |
eerror "The option \"${i}\" is not allowed" |
149 |
return 1 |
149 |
return 1 |
Lines 158-166
Link Here
|
158 |
[[ " ${opts} " != *" mru "* ]] && opts="${opts} mru ${mtu}" |
158 |
[[ " ${opts} " != *" mru "* ]] && opts="${opts} mru ${mtu}" |
159 |
fi |
159 |
fi |
160 |
|
160 |
|
161 |
# Detach if we're not idling |
161 |
# Set linkname because we need /var/run/ppp-${linkname}.pid |
162 |
[[ " ${opts} " != *" idle "* && " ${opts} " != *" updetach "* ]] \ |
162 |
# This pidfile has the advantage of being there, even if ${iface} interface was never started |
163 |
&& opts="${opts} updetach" |
163 |
opts="linkname ${iface} ${opts}" |
164 |
|
164 |
|
165 |
# Setup auth info |
165 |
# Setup auth info |
166 |
[[ -n ${username} ]] && opts="user \"${username}\" ${opts}" |
166 |
[[ -n ${username} ]] && opts="user \"${username}\" ${opts}" |
Lines 228-238
Link Here
|
228 |
[[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" |
228 |
[[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" |
229 |
|
229 |
|
230 |
ebegin "Running pppd" |
230 |
ebegin "Running pppd" |
231 |
i=$( eval /usr/sbin/pppd ${opts} ) |
231 |
i=$( eval /usr/sbin/pppd ${opts} 2>&1 ) |
232 |
eend $? "${i}" || return 1 |
232 |
eend $? "${i}" || return 1 |
233 |
|
233 |
|
234 |
local addr=$( interface_get_address "${iface}" ) |
234 |
if [[ " ${opts} " == *" updetach "* ]]; then |
235 |
einfo "${iface} received address ${addr}" |
235 |
local addr=$( interface_get_address "${iface}" ) |
|
|
236 |
einfo "${iface} received address ${addr}" |
237 |
fi |
236 |
} |
238 |
} |
237 |
|
239 |
|
238 |
# bool pppd_stop(char *iface) |
240 |
# bool pppd_stop(char *iface) |
Lines 242-252
Link Here
|
242 |
# 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, |
243 |
# otherwise non-zero (false) |
245 |
# otherwise non-zero (false) |
244 |
pppd_stop() { |
246 |
pppd_stop() { |
245 |
local iface="$1" pidfile="/var/run/$1.pid" |
247 |
local iface="$1" pidfile="/var/run/ppp-$1.pid" |
246 |
|
248 |
|
247 |
[[ ! -s ${pidfile} ]] && return 0 |
249 |
[[ ! -s ${pidfile} ]] && return 0 |
248 |
|
250 |
|
249 |
local pid=$(<"${pidfile}") |
251 |
local pid |
|
|
252 |
read pid <"${pidfile}" #PID is the first line of the pidfile |
250 |
einfo "Stopping pppd on ${iface}" |
253 |
einfo "Stopping pppd on ${iface}" |
251 |
kill -s TERM "${pid}" |
254 |
kill -s TERM "${pid}" |
252 |
process_finished "${pid}" /usr/sbin/pppd |
255 |
process_finished "${pid}" /usr/sbin/pppd |