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=527453ff4851a0594f804aa2c572e820706827c8;p=project%2Fluci.git luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config Signed-off-by: Jonathan Duncan --- 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 fc28d2bbe5..58537f38f8 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,