From patchwork Wed Apr 27 09:14:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 615477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qvvSc1d6Rz9s3s for ; Wed, 27 Apr 2016 19:15:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=vmfz/tCa; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CE086B80DE3; Wed, 27 Apr 2016 11:14:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Wed, 27 Apr 2016 11:14:26 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 66C31B80C9B for ; Wed, 27 Apr 2016 11:14:17 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -7 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 27 Apr 2016 11:14:16 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id w143so10885741wmw.3 for ; Wed, 27 Apr 2016 02:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uzKBPSw1mFz2MQrFJ2yKH1P/DDh/mdyYH6N6+b/h0PQ=; b=vmfz/tCah5PDxMe6u6vpvmOLjrluDV0rLM3RS1XgdfAiN7Awol1YSaUw7TqzLNr5wv SV++Lm2NSF9Sy2wD3DCNCbA/j4sL9ucAZX/opbQEzqx8LpLLd+IXIbx9wvU69Rv645Lr 8HIRicsjSbz0misuknIlt/eS3E7Az9mo5jrVbml/U7B5i16kff7Lc95F/V/Ps0BJnKZp GXgpPpCyszjGtrG/J9FOmMNWoVQrDccUXVA0aacsKzomJJIyAf02pZWX74OUGAujq0x+ vV7gaFPSGE6BeM/eXKCy55dF1woVGl3n7nrII4uBHlrBoVQmvvWk9zVQqCPPtTaic5tL Tu+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uzKBPSw1mFz2MQrFJ2yKH1P/DDh/mdyYH6N6+b/h0PQ=; b=NAzg0TppdcX5CD2UYxx5IWfqTWkTj9975RoWuay111/6ChDqkP6ruFVdkf6GZASzIF d3H5tKDHIKCeoDGZdjkZrwGNZTpOgNLJ9P0PUqoIjnj/y53kxDjVm/TLCfo8R5V0gbCw adlBBOnOw2utO4VW/4gX5vsvIhmVLaKM6d3QgsY+7XZQPKeQgDuCeUbbnX7iyy13Sq1b UUNA0eewqEBvcoaWaWZ3eo7rTSxt7/Nz/ybPJATCOwahAKzvVAAr37Aasg+t5YdtT08H kN3zkN8EKNL5QAInN8iG0YjDgDlaxSb+kgfMS0v5YX3o/NJ6XsvakDo1uJSRB7yQ7dtS id8g== X-Gm-Message-State: AOPr4FV3Bfbs+wCw0yjonCcEsGTvBIXESC3Fyh5r1kEOQHRBR/IDR7XTHe3nwNWeYxvUPA== X-Received: by 10.28.230.137 with SMTP id e9mr9090405wmi.0.1461748456426; Wed, 27 Apr 2016 02:14:16 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id w3sm3002161wjt.0.2016.04.27.02.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Apr 2016 02:14:16 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org Date: Wed, 27 Apr 2016 11:14:00 +0200 Message-Id: <1461748442-9469-4-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461748442-9469-1-git-send-email-dedeckeh@gmail.com> References: <1461748442-9469-1-git-send-email-dedeckeh@gmail.com> Subject: [OpenWrt-Devel] [PATCH 4/6] dropbear: Add procd interface triggers when interface config is specified X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker , cyrus@openwrt.org MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" A dropbear instance having an interface config won't start if the interface is down as no IP address is available. Adding interface triggers for each configured interface executing the dropbear reload script will start the dropbear instance when the interface is up. Signed-off-by: Hans Dedecker --- package/network/services/dropbear/Makefile | 2 +- .../network/services/dropbear/files/dropbear.init | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 593e0a8..8d4e7bc 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dropbear PKG_VERSION:=2015.71 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index 03745c9..5c3345d 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -106,6 +106,12 @@ keygen() chmod 0700 /etc/dropbear } +load_interfaces() +{ + config_get interface "$1" Interface + interfaces=" ${interface} ${interfaces}" +} + start_service() { [ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen @@ -119,7 +125,21 @@ start_service() service_triggers() { - procd_add_reload_trigger "dropbear" + local interfaces + + procd_open_trigger + procd_add_config_trigger "config.change" "dropbear" /etc/init.d/dropbear reload + + config_load "${NAME}" + config_foreach load_interfaces dropbear + + [ -n "${interfaces}" ] & { + for n in $interfaces ; do + procd_add_interface_trigger "interface.*" $n /etc/init.d/dropbear reload + done + } + procd_close_trigger + procd_add_validation validate_section_dropbear }