diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2014-04-26 13:45:35 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2014-05-06 12:00:54 +0200 |
commit | 75b7a33a1275e9cdb7c0959f0edfef81ff2c8e43 (patch) | |
tree | d0e1c3428a1c02aa93360d4f1aae0dd69c150e95 /src | |
parent | b4f7bf8ca067542b48ed4099c9feaf9f62f89a62 (diff) | |
download | netctl-75b7a33a1275e9cdb7c0959f0edfef81ff2c8e43.tar.gz netctl-75b7a33a1275e9cdb7c0959f0edfef81ff2c8e43.tar.xz |
Fix pid lookup for killing pppd
The pid file contains more than just the pid: on the second line it
records the interface pppd manages.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/connections/mobile_ppp | 7 | ||||
-rw-r--r-- | src/lib/connections/pppoe | 15 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/connections/mobile_ppp b/src/lib/connections/mobile_ppp index 6df30d8..785457d 100644 --- a/src/lib/connections/mobile_ppp +++ b/src/lib/connections/mobile_ppp @@ -79,12 +79,15 @@ EOF } mobile_ppp_down() { - local options chat pidfile + local options chat pidfile pid options="$STATE_DIR/mobile_ppp.$Interface.$Profile/options" chat="$STATE_DIR/mobile_ppp.$Interface.$Profile/modem.chat" pidfile="/var/run/ppp-$Profile.pid" - [[ -r $pidfile ]] && kill "$(< "$pidfile")" + if [[ -r $pidfile ]]; then + read pid < "$pidfile" + (( pid )) && kill "$pid" + fi rm "$options" "$chat" rmdir "$(dirname "$options")" diff --git a/src/lib/connections/pppoe b/src/lib/connections/pppoe index 78cc35f..9816658 100644 --- a/src/lib/connections/pppoe +++ b/src/lib/connections/pppoe @@ -8,9 +8,7 @@ quote_word() { } pppoe_up() { - local options pidfile pppn - options="$STATE_DIR/pppoe.$Interface.$Profile/options" - pidfile="/var/run/ppp-$Profile.pid" + local options="$STATE_DIR/pppoe.$Interface.$Profile/options" if ! is_interface "$Interface"; then report_error "Interface '$Interface' does not exist" @@ -55,18 +53,17 @@ EOF report_error "Could not establish a ppp connection for profile '$Profile'." return 1 fi - - [[ -r $pidfile ]] || return 0 - pppn=$(grep -l "$(< "$pidfile")" /var/run/ppp[[:digit:]]*.pid) - report_notice "PPP unit for profile '$Profile': ${pppn:9:-4}" } pppoe_down() { - local options pidfile + local options pidfile pid options="$STATE_DIR/pppoe.$Interface.$Profile/options" pidfile="/var/run/ppp-$Profile.pid" - [[ -r $pidfile ]] && kill "$(< "$pidfile")" + if [[ -r $pidfile ]]; then + read pid < "$pidfile" + (( pid )) && kill "$pid" + fi rm "$options" rmdir "$(dirname "$options")" |