[OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown

John Crispin john at phrozen.org
Thu Jul 12 02:49:32 EDT 2018



On 12/07/18 04:36, Luis Araneda wrote:
> From: Christian Schoenebeck <christian.schoenebeck at gmail.com>
>
> Override the default shutdown action (stop) and close all processes
> of dropbear
>
> Since commit 498fe85, the stop action only closes the process
> that's listening for new connections, maintaining the ones with
> existing clients.
> This poses a problem when restarting or shutting-down a device,
> because the connections with existing SSH clients, like OpenSSH,
> are not properly closed, causing them to hang.
>
> This situation can be avoided by closing all dropbear processes when
> shutting-down the system, which closes properly the connections with
> current clients.

does this break sysupgrade when run via ssh ?
     John

> Signed-off-by: Christian Schoenebeck <christian.schoenebeck at gmail.com>
> [Luis: Rework commit message]
> Signed-off-by: Luis Araneda <luaraneda at gmail.com>
> ---
>   package/network/services/dropbear/files/dropbear.init | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
> index 2225113498..b86e52d8bc 100755
> --- a/package/network/services/dropbear/files/dropbear.init
> +++ b/package/network/services/dropbear/files/dropbear.init
> @@ -148,6 +148,11 @@ service_triggers()
>   	procd_add_validation validate_section_dropbear
>   }
>   
> +shutdown() {
> +	# close all open connections
> +	killall dropbear
> +}
> +
>   killclients()
>   {
>   	local ignore=''


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list