From 48d9521ecd75e6651d750642ae1d6da3ada2bc52 Mon Sep 17 00:00:00 2001
From: Syrone Wong <wong.syrone@gmail.com>
Date: Wed, 6 May 2020 07:49:04 +0800
Subject: [PATCH 1/2] wsdd2: fix infinite loop when BI_PARM is never set

If BI_PARM is never set, it's "" and causes
infinite loop (before my PR sent upstream) or
error out (after my PR sent upstream).
Append -b option only if it's valid.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
---
 net/wsdd2/files/wsdd2.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wsdd2/files/wsdd2.init b/net/wsdd2/files/wsdd2.init
index ee60eee2d..ff7134d4f 100644
--- a/net/wsdd2/files/wsdd2.init
+++ b/net/wsdd2/files/wsdd2.init
@@ -68,7 +68,7 @@ start_service() {
 	[ -n "$ifname" ] && procd_append_param command -i "$ifname"
 	procd_append_param command -N "$NB_PARM"
 	procd_append_param command -G "$WG_PARM"
-	procd_append_param command -b "$BI_PARM"
+	[ "x${BI_PARM}" != "x" ] && procd_append_param command -b "$BI_PARM"
 	procd_set_param respawn
 	procd_set_param file "$SMB_CONF"
 	procd_close_instance

From e8bee3aaa321679f240529600603d4af6c6bf798 Mon Sep 17 00:00:00 2001
From: Syrone Wong <wong.syrone@gmail.com>
Date: Wed, 6 May 2020 10:10:38 +0800
Subject: [PATCH 2/2] wsdd2: bump PKG_RELEASE; refine init script

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
---
 net/wsdd2/Makefile         | 2 +-
 net/wsdd2/files/wsdd2.init | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wsdd2/Makefile b/net/wsdd2/Makefile
index b0cfe331e..eac3bd725 100644
--- a/net/wsdd2/Makefile
+++ b/net/wsdd2/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wsdd2
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/Andy2244/wsdd2.git
diff --git a/net/wsdd2/files/wsdd2.init b/net/wsdd2/files/wsdd2.init
index ff7134d4f..ca9653d6c 100644
--- a/net/wsdd2/files/wsdd2.init
+++ b/net/wsdd2/files/wsdd2.init
@@ -68,7 +68,7 @@ start_service() {
 	[ -n "$ifname" ] && procd_append_param command -i "$ifname"
 	procd_append_param command -N "$NB_PARM"
 	procd_append_param command -G "$WG_PARM"
-	[ "x${BI_PARM}" != "x" ] && procd_append_param command -b "$BI_PARM"
+	[ "x${BI_PARM}" = "x" ] || procd_append_param command -b "$BI_PARM"
 	procd_set_param respawn
 	procd_set_param file "$SMB_CONF"
 	procd_close_instance