Patchwork dropbear: Do not kill client connections on stop and restart

login
register
mail settings
Submitter Holger Hans Peter Freyther
Date Feb. 15, 2013, 5:09 p.m.
Message ID <1360948140-11663-1-git-send-email-holger@moiji-mobile.com>
Download mbox | patch
Permalink /patch/44697/
State New
Headers show

Comments

Holger Hans Peter Freyther - Feb. 15, 2013, 5:09 p.m.
Use the pidfile functionality of start-stop-daemon to only kill
the dropbear server process and not the active client connections.

OE-classic used to have this functionality, a patch for it was
applied in revision 6adaccf00601e1bc3ce1ede5417eabcdf1671768.
---
 meta/recipes-core/dropbear/dropbear.inc  |    2 +-
 meta/recipes-core/dropbear/dropbear/init |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
index 8d94e5b..85b35ef 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -2,7 +2,7 @@  DESCRIPTION = "Dropbear is a lightweight SSH and SCP implementation"
 HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
 SECTION = "console/network"
 
-INC_PR = "r2"
+INC_PR = "r3"
 
 # some files are from other projects and have others license terms:
 #   public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
diff --git a/meta/recipes-core/dropbear/dropbear/init b/meta/recipes-core/dropbear/dropbear/init
index 5cc2d65..e8fed3f 100755
--- a/meta/recipes-core/dropbear/dropbear/init
+++ b/meta/recipes-core/dropbear/dropbear/init
@@ -15,6 +15,7 @@  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/dropbear
 NAME=dropbear
 DESC="Dropbear SSH server"
+PIDFILE=/var/run/dropbear.pid
 
 DROPBEAR_PORT=22
 DROPBEAR_EXTRA_ARGS=
@@ -80,24 +81,24 @@  case "$1" in
 	KEY_ARGS=""
 	test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
 	test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
-	start-stop-daemon -S \
+	start-stop-daemon -S -p $PIDFILE \
 	  -x "$DAEMON" -- $KEY_ARGS \
 	    -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
 	echo "$NAME."
 	;;
   stop)
 	echo -n "Stopping $DESC: "
-	start-stop-daemon -K -x "$DAEMON"
+	start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
 	echo "$NAME."
 	;;
   restart|force-reload)
 	echo -n "Restarting $DESC: "
-	start-stop-daemon -K -x "$DAEMON"
+	start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
 	sleep 1
 	KEY_ARGS=""
 	test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
 	test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
-	start-stop-daemon -S \
+	start-stop-daemon -S -p $PIDFILE \
 	  -x "$DAEMON" -- $KEY_ARGS \
 	    -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
 	echo "$NAME."