From: Jonathan Duncan Date: Sun, 24 Sep 2023 15:16:35 +0000 (+0100) Subject: luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=32e1e8c564dc0d62a8ad43d589609e29b095e550;p=project%2Fluci.git luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config Signed-off-by: Jonathan Duncan (cherry picked from commit 527453ff4851a0594f804aa2c572e820706827c8) --- 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 2126403de6..3db1fe80f3 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,