[LEDE-DEV] [PATCH] dropbear: Fix append_port in IPv6 case

Laurent GUERBY laurent at guerby.net
Sat Jul 9 12:05:38 PDT 2016


dropbear uses -p [ip6%phy]:port syntax, now correctly handled by append_port.

Signed-off-by: Laurent GUERBY <laurent at guerby.net>
---
 package/network/services/dropbear/files/dropbear.init | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index 5c3345d..d04df44 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -16,13 +16,21 @@ append_ports()
 {
 	local ipaddrs="$1"
 	local port="$2"
+	local iface="$3"
+	local phy
 
 	[ -z "$ipaddrs" ] && {
 		procd_append_param command -p "$port"
 		return
 	}
 
+	network_get_physdev phy "$iface"
+
 	for addr in $ipaddrs; do
+		case "$addr" in
+			*:*) dropbear_addr="[$addr%$phy]";;
+			*) dropbear_addr="$addr";;
+		esac
 		procd_append_param command -p "$addr:$port"
 	done
 }
@@ -75,7 +83,7 @@ dropbear_instance()
 	[ "${RootLogin}" -eq 0 ] && procd_append_param command -w
 	[ -n "${rsakeyfile}" ] && procd_append_param command -r "${rsakeyfile}"
 	[ -n "${BannerFile}" ] && procd_append_param command -b "${BannerFile}"
-	append_ports "${ipaddrs}" "${Port}"
+	append_ports "${ipaddrs}" "${Port}" "${Interface}"
 	[ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I "${IdleTimeout}"
 	[ "${SSHKeepAlive}" -ne 0 ] && procd_append_param command -K "${SSHKeepAlive}"
 	[ "${mdns}" -ne 0 ] && procd_add_mdns "ssh" "tcp" "$Port" "daemon=dropbear"
-- 
2.1.4




More information about the Lede-dev mailing list