wireguard-tools: fix script errors
Some checks failed
Build all core packages / Build all core packages for selected target (push) Waiting to run
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled

follow-up to 148207730a

Schoolboy error on the peer_psk value.

Also fix an issue when joining peer IPv4 and IPv6 AllowedIPs
(${peer_a_ips/ /, } replaces only the first space, while
${peer_a_ips// /, } replaces all the spaces).

Closes: https://github.com/openwrt/openwrt/issues/21847
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21851
Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit 3f0de6a28d)
Link: https://github.com/openwrt/openwrt/pull/21840
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Paul Donald 2026-02-03 06:18:01 +01:00 committed by Hauke Mehrtens
parent 436b090bc7
commit 85342bea07

View file

@ -84,7 +84,7 @@ proto_wireguard_setup() {
config_get peer_port "$section" "endpoint_port" "51820"
config_get peer_a_ips "$section" "allowed_ips"
config_get peer_p_ka "$section" "persistent_keepalive"
config_get peer_psk "$section" "peer_psk"
config_get peer_psk "$section" "preshared_key"
[ "${peer_eph##*:}" != "$peer_eph" ] && peer_eph="[$peer_eph]"
@ -94,7 +94,7 @@ proto_wireguard_setup() {
[ -n "${peer_key}" ] && peer_block="${peer_block}PublicKey=${peer_key}\n"
[ -n "${peer_psk}" ] && peer_block="${peer_block}PresharedKey=${peer_psk}\n"
[ -n "${peer_eph}" ] && peer_block="${peer_block}Endpoint=${peer_eph}${peer_port:+:$peer_port}\n"
[ -n "${peer_a_ips}" ] && peer_block="${peer_block}AllowedIPs=${peer_a_ips/ /, }\n"
[ -n "${peer_a_ips}" ] && peer_block="${peer_block}AllowedIPs=${peer_a_ips// /, }\n"
[ -n "${peer_p_ka}" ] && peer_block="${peer_block}PersistentKeepalive=${peer_p_ka}\n"
[ -n "$peer_key" ] && peer_config="$peer_config$peer_block\n"