Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 447114

Summary: net-misc/openconnect init script loses control if internet connection goes down
Product: Gentoo Linux Reporter: Matthew Schultz <mattsch>
Component: New packagesAssignee: Matthew Schultz <mattsch>
Status: RESOLVED FIXED    
Severity: normal CC: proxy-maint
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: openconnect.init.in
openconnect.init.in.patch

Description Matthew Schultz 2012-12-13 14:44:39 UTC
The init script will lose control over the pid file if the internet connection goes down and the process stalls.  The only way to restart the process is to manually kill the process and make sure the pid file is removed.

Reproducible: Always

Steps to Reproduce:
1. Disconnect the internet connection and wait for the openconnect vpn to stall and disconnect.
2. When the internet connection is brought back up, try to restart the daemon.
Actual Results:  
/etc/init.d/openconnect.vpn0 restart
 * Stopping OpenConnect: vpn0 ...
 * start-stop-daemon: 1 process refused to stop                                                                                                                                                              [ !! ]
 * ERROR: openconnect.vpn0 failed to stop

Expected Results:  
/etc/init.d/openconnect.vpn0 restart
 * Stopping OpenConnect: vpn0 ...                                                                                                                                                                            [ ok ]
 * Starting OpenConnect: vpn0 ...
Comment 1 Matthew Schultz 2012-12-13 14:46:37 UTC
Created attachment 332224 [details]
openconnect.init.in

Added specification of pid file to the openconnect binary in addition to the start stop daemon so the process can still be restarted when the internet connection comes back up.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2012-12-13 16:53:51 UTC
Comment on attachment 332224 [details]
openconnect.init.in

--- files/openconnect.init.in   2012-12-13 17:52:55.474864214 +0100
+++ -   2012-12-13 17:53:36.904769351 +0100
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/openconnect/files/openconnect.init.in,v 1.3 2012/12/11 19:45:50 hwoarang Exp $
+# $Header: $
 
 VPN="${RC_SVCNAME#*.}"
 VPNLOG="/var/log/openconnect/${VPN}"
@@ -82,7 +82,7 @@
 
        start-stop-daemon --start --make-pidfile --pidfile "${VPNPID}" --stderr "${VPNERRFILE}" --stdout "${VPNLOGFILE}" --background \
                        --exec /usr/sbin/openconnect \
-                       -- ${!VPNOPTS} ${!SERVER} <<< ${!PASSWORD}
+                       -- --pid-file="${VPNPID}" ${!VPNOPTS} ${!SERVER} <<< ${!PASSWORD}
 
        local retval=$?
Comment 3 Markos Chandras (RETIRED) gentoo-dev 2012-12-21 13:44:24 UTC
It would be preferred if the diff was attached to this bug to avoid copy/paste errors.
Comment 4 Matthew Schultz 2012-12-21 14:09:28 UTC
Created attachment 332922 [details, diff]
openconnect.init.in.patch
Comment 5 Markos Chandras (RETIRED) gentoo-dev 2012-12-22 11:21:50 UTC
+*openconnect-4.07-r2 (22 Dec 2012)
+
+  22 Dec 2012; Markos Chandras <hwoarang@gentoo.org>
+  +openconnect-4.07-r2.ebuild, files/openconnect.init.in:
+   Revbump to fix #447114 and #447106. Thanks to Matthew Schultz
+  <mattsch@gmail.com>
+