From 527453ff4851a0594f804aa2c572e820706827c8 Mon Sep 17 00:00:00 2001 From: Jonathan Duncan Date: Sun, 24 Sep 2023 16:16:35 +0100 Subject: [PATCH] luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config Signed-off-by: Jonathan Duncan --- .../htdocs/luci-static/resources/protocol/wireguard.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index fc28d2bbe578..58537f38f8b9 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -700,6 +700,11 @@ return network.registerProtocol('wireguard', { eport = this.section.formvalue(section_id, 'endpoint_port'), keep = this.section.formvalue(section_id, 'persistent_keepalive'); + // If endpoint is IPv6 we must escape it with [] + if (endpoint.indexOf(':') > 0) { + endpoint = '['+endpoint+']'; + } + return [ '[Interface]', 'PrivateKey = ' + prv,