mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 03:30:37 +02:00
[package] 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 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21387 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
19b6acd090
commit
cd48af9071
@ -7,14 +7,18 @@ stop_interface_ppp() {
|
|||||||
local ifname
|
local ifname
|
||||||
config_get ifname "$cfg" ifname
|
config_get ifname "$cfg" ifname
|
||||||
|
|
||||||
[ -f "/var/run/ppp-${ifname}.pid" ] && {
|
local link="$proto-${ifname#$proto-}"
|
||||||
local pid="$(head -n1 /var/run/ppp-${ifname}.pid 2>/dev/null)"
|
[ -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 && \
|
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
|
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"
|
[ -f "$lock" ] && lock -u "$lock"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,19 +114,19 @@ start_pppd() {
|
|||||||
config_get_bool ipv6 "$cfg" ipv6 0
|
config_get_bool ipv6 "$cfg" ipv6 0
|
||||||
[ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""
|
[ "$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%%[, ]*}} \
|
${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
|
||||||
$demandargs \
|
$demandargs \
|
||||||
$peerdns \
|
$peerdns \
|
||||||
$defaultroute \
|
$defaultroute \
|
||||||
${username:+user "$username" password "$password"} \
|
${username:+user "$username" password "$password"} \
|
||||||
linkname "$link" \
|
|
||||||
ipparam "$cfg" \
|
ipparam "$cfg" \
|
||||||
ifname "$link" \
|
ifname "$link" \
|
||||||
${connect:+connect "$connect"} \
|
${connect:+connect "$connect"} \
|
||||||
${disconnect:+disconnect "$disconnect"} \
|
${disconnect:+disconnect "$disconnect"} \
|
||||||
${ipv6} \
|
${ipv6} \
|
||||||
${pppd_options}
|
${pppd_options} \
|
||||||
|
nodetach
|
||||||
|
|
||||||
lock -u "/var/lock/ppp-${link}"
|
lock -u "/var/lock/ppp-${link}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user