From: Felix Fietkau Date: Mon, 27 Jan 2025 11:43:13 +0000 (+0100) Subject: unetd: update to Git HEAD (2025-01-27) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c34eee5f39827ca38c9d4d0acef46848098867fe;p=openwrt%2Fstaging%2Fnbd.git unetd: update to Git HEAD (2025-01-27) c293afa01c13 network: add support for the local_network option Signed-off-by: Felix Fietkau --- diff --git a/package/network/services/unetd/Makefile b/package/network/services/unetd/Makefile index a7f030abb6..1d47ca63ca 100644 --- a/package/network/services/unetd/Makefile +++ b/package/network/services/unetd/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=unetd PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git -PKG_SOURCE_DATE:=2025-01-26 -PKG_SOURCE_VERSION:=d13752814651c70d2afc71383612fafc835b631b -PKG_MIRROR_HASH:=c9de65ae92af2498fcd9d55f9cd2017cb9ac79b03ed5816da21161aa24f226b9 +PKG_SOURCE_DATE:=2025-01-27 +PKG_SOURCE_VERSION:=c293afa01c1328ee8a18fc407948d0529353d7eb +PKG_MIRROR_HASH:=f91e26cd4d4304170d99a80551691291d7920b9f4e357b0775cdeb138523ccc8 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/services/unetd/files/unetd.sh b/package/network/services/unetd/files/unetd.sh index 2117eab391..726ee76565 100644 --- a/package/network/services/unetd/files/unetd.sh +++ b/package/network/services/unetd/files/unetd.sh @@ -18,6 +18,7 @@ proto_unet_init_config() { proto_config_add_string domain proto_config_add_boolean dht proto_config_add_array "tunnels:list(string)" + proto_config_add_array "local_network:list(string)" proto_config_add_array "connect:list(string)" proto_config_add_array "peer_data:list(string)" no_device=1 @@ -25,6 +26,17 @@ proto_unet_init_config() { no_proto_task=1 } +add_array() { + local name="$1" + local val="$2" + + json_add_array "$name" + for c in $val; do + json_add_string "" "$c" + done + json_close_array +} + proto_unet_setup() { local config="$1" @@ -33,6 +45,7 @@ proto_unet_setup() { json_get_values tunnels tunnels json_get_values connect connect json_get_values peer_data peer_data + json_get_values local_network local_network device="${device:-$config}" [ -n "$auth_key" ] && type="${type:-dynamic}" @@ -58,17 +71,9 @@ proto_unet_setup() { done json_close_object - json_add_array auth_connect - for c in $connect; do - json_add_string "" "$c" - done - json_close_array - - json_add_array peer_data - for c in $peer_data; do - json_add_string "" "$c" - done - json_close_array + add_array local_network "$local_network" + add_array auth_connect "$connect" + add_array peer_data "$peer_data" ip link del dev "$device" >/dev/null 2>&1 ip link add dev "$device" type wireguard || {