aboutsummaryrefslogtreecommitdiffstats
path: root/package/ppp/files/ppp.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-05-06 17:07:31 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-05-06 17:07:31 +0000
commit4eee1bb4395832fcdec2813d1eb8c64d8e1d9121 (patch)
tree7401a3ea0311cfc28970203141366f7377554c59 /package/ppp/files/ppp.sh
parentdd38b15b7545e8250859f6e2583f90dc9a8d5a66 (diff)
downloadupstream-4eee1bb4395832fcdec2813d1eb8c64d8e1d9121.tar.gz
upstream-4eee1bb4395832fcdec2813d1eb8c64d8e1d9121.tar.bz2
upstream-4eee1bb4395832fcdec2813d1eb8c64d8e1d9121.zip
ppp: - make pppd shutdown more robust as pptp hangs when the underlying connection is gone - don't rely on pid files generated by pppd, they're missing if the link is done, generate a per-instance pidfile with ssd instead
SVN-Revision: 21387
Diffstat (limited to 'package/ppp/files/ppp.sh')
-rw-r--r--package/ppp/files/ppp.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh
index f4417bb67e..42daef9220 100644
--- a/package/ppp/files/ppp.sh
+++ b/package/ppp/files/ppp.sh
@@ -7,14 +7,18 @@ stop_interface_ppp() {
local ifname
config_get ifname "$cfg" ifname
- [ -f "/var/run/ppp-${ifname}.pid" ] && {
- local pid="$(head -n1 /var/run/ppp-${ifname}.pid 2>/dev/null)"
+ local link="$proto-${ifname#$proto-}"
+ [ -f "/var/run/ppp-${link}.pid" ] && {
+ local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
+ local try=0
grep -qs pppd "/proc/$pid/cmdline" && kill -TERM $pid && \
+ while grep -qs pppd "/proc/$pid/cmdline" && [ $((try++)) -lt 5 ]; do sleep 1; done
+ grep -qs pppd "/proc/$pid/cmdline" && kill -KILL $pid && \
while grep -qs pppd "/proc/$pid/cmdline"; do sleep 1; done
- rm -f "/var/run/ppp-${ifname}.pid"
+ rm -f "/var/run/ppp-${link}.pid"
}
- local lock="/var/lock/ppp-$ifname"
+ local lock="/var/lock/ppp-$link"
[ -f "$lock" ] && lock -u "$lock"
}
@@ -110,19 +114,19 @@ start_pppd() {
config_get_bool ipv6 "$cfg" ipv6 0
[ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""
- /usr/sbin/pppd "$@" \
+ start-stop-daemon -S -b -x /usr/sbin/pppd -m -p /var/run/ppp-$link.pid -- "$@" \
${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
$demandargs \
$peerdns \
$defaultroute \
${username:+user "$username" password "$password"} \
- linkname "$link" \
ipparam "$cfg" \
ifname "$link" \
${connect:+connect "$connect"} \
${disconnect:+disconnect "$disconnect"} \
${ipv6} \
- ${pppd_options}
+ ${pppd_options} \
+ nodetach
lock -u "/var/lock/ppp-${link}"
}