Merge pull request #6593 from Kasoo/luci-proto-wireguard/ipv6_endpoint_config

luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config
This commit is contained in:
Jo-Philipp Wich 2023-09-25 09:22:19 +02:00 committed by GitHub
commit 2a09ea0003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -700,6 +700,11 @@ return network.registerProtocol('wireguard', {
eport = this.section.formvalue(section_id, 'endpoint_port'), eport = this.section.formvalue(section_id, 'endpoint_port'),
keep = this.section.formvalue(section_id, 'persistent_keepalive'); keep = this.section.formvalue(section_id, 'persistent_keepalive');
// If endpoint is IPv6 we must escape it with []
if (endpoint.indexOf(':') > 0) {
endpoint = '['+endpoint+']';
}
return [ return [
'[Interface]', '[Interface]',
'PrivateKey = ' + prv, 'PrivateKey = ' + prv,