Changeset 21387


Ignore:
Timestamp:
2010-05-06T19:07:31+02:00 (8 years ago)
Author:
jow
Message:

[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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/ppp/files/ppp.sh

    r21386 r21387  
    88        config_get ifname "$cfg" ifname 
    99 
    10         [ -f "/var/run/ppp-${ifname}.pid" ] && { 
    11                 local pid="$(head -n1 /var/run/ppp-${ifname}.pid 2>/dev/null)" 
     10        local link="$proto-${ifname#$proto-}" 
     11        [ -f "/var/run/ppp-${link}.pid" ] && { 
     12                local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)" 
     13                local try=0 
    1214                grep -qs pppd "/proc/$pid/cmdline" && kill -TERM $pid && \ 
     15                        while grep -qs pppd "/proc/$pid/cmdline" && [ $((try++)) -lt 5 ]; do sleep 1; done 
     16                grep -qs pppd "/proc/$pid/cmdline" && kill -KILL $pid && \ 
    1317                        while grep -qs pppd "/proc/$pid/cmdline"; do sleep 1; done 
    14                 rm -f "/var/run/ppp-${ifname}.pid" 
     18                rm -f "/var/run/ppp-${link}.pid" 
    1519        } 
    1620 
    17         local lock="/var/lock/ppp-$ifname" 
     21        local lock="/var/lock/ppp-$link" 
    1822        [ -f "$lock" ] && lock -u "$lock" 
    1923} 
     
    111115        [ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6="" 
    112116 
    113         /usr/sbin/pppd "$@" \ 
     117        start-stop-daemon -S -b -x /usr/sbin/pppd -m -p /var/run/ppp-$link.pid -- "$@" \ 
    114118                ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \ 
    115119                $demandargs \ 
     
    117121                $defaultroute \ 
    118122                ${username:+user "$username" password "$password"} \ 
    119                 linkname "$link" \ 
    120123                ipparam "$cfg" \ 
    121124                ifname "$link" \ 
     
    123126                ${disconnect:+disconnect "$disconnect"} \ 
    124127                ${ipv6} \ 
    125                 ${pppd_options} 
     128                ${pppd_options} \ 
     129                nodetach 
    126130 
    127131        lock -u "/var/lock/ppp-${link}" 
Note: See TracChangeset for help on using the changeset viewer.