Re: [OpenWrt-Devel] [PATCH] dropbear: fix dropbear startup issue

2018-12-18 Thread Dirk Feytons
On Tue, 18 Dec 2018 at 14:16, Hans Dedecker  wrote:
>
> Interface triggers are installed by the dropbear init script in case an
> interface is configured for a given dropbear uci section.
> As dropbear is started after network the interface trigger event can be
> missed during a small window; this is especially the case if lan is
> specified as interface.
> Fix this by starting dropbear before network so no interface trigger
> is missed. As dropbear is started earlier than netifd add a boot function
> to avoid the usage of network.sh functions as call to such functions will
> fail at boottime.
>
> Signed-off-by: Hans Dedecker 
> ---
>  package/network/services/dropbear/Makefile|  2 +-
>  package/network/services/dropbear/files/dropbear.init | 10 +-
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/package/network/services/dropbear/Makefile 
> b/package/network/services/dropbear/Makefile
> index 02a42f73d5..d0a43f1558 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:=2018.76
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  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 fb3f6dd84e..b392e8b745 100755
> --- a/package/network/services/dropbear/files/dropbear.init
> +++ b/package/network/services/dropbear/files/dropbear.init
> @@ -3,7 +3,7 @@
>  # Copyright (C) 2006 Carlos Sobrinho
>
>  START=50
> -STOP=50
> +STOP=19

Shouldn't that be START?

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dropbear: fix dropbear startup issue

2018-12-18 Thread Jo-Philipp Wich
Hi Hans,

> [...]
> +boot()
> +{
> + BOOT=1
> + start "@"

Typo here, should likely be "$@".

Otherwise Acked-by.

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] dropbear: fix dropbear startup issue

2018-12-18 Thread Hans Dedecker
Interface triggers are installed by the dropbear init script in case an
interface is configured for a given dropbear uci section.
As dropbear is started after network the interface trigger event can be
missed during a small window; this is especially the case if lan is
specified as interface.
Fix this by starting dropbear before network so no interface trigger
is missed. As dropbear is started earlier than netifd add a boot function
to avoid the usage of network.sh functions as call to such functions will
fail at boottime.

Signed-off-by: Hans Dedecker 
---
 package/network/services/dropbear/Makefile|  2 +-
 package/network/services/dropbear/files/dropbear.init | 10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/package/network/services/dropbear/Makefile 
b/package/network/services/dropbear/Makefile
index 02a42f73d5..d0a43f1558 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:=2018.76
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 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 fb3f6dd84e..b392e8b745 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -3,7 +3,7 @@
 # Copyright (C) 2006 Carlos Sobrinho
 
 START=50
-STOP=50
+STOP=19
 
 USE_PROCD=1
 PROG=/usr/sbin/dropbear
@@ -148,6 +148,8 @@ dropbear_instance()
}
 
[ -n "${Interface}" ] && {
+   [ -n "${BOOT}" ] && return 0
+
network_get_ipaddrs_all ipaddrs "${Interface}" || {
echo "interface ${Interface} has no physdev or physdev 
has no suitable ip"
return 1
@@ -191,6 +193,12 @@ load_interfaces()
[ "${enable}" = "1" ] && interfaces=" ${interface} ${interfaces}"
 }
 
+boot()
+{
+   BOOT=1
+   start "@"
+}
+
 start_service()
 {
hk_generate_as_needed
-- 
2.19.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel