Skip to content

Commit

Permalink
luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wire…
Browse files Browse the repository at this point in the history
…guard config

Signed-off-by: Jonathan Duncan <[email protected]>
  • Loading branch information
Kasoo committed Sep 24, 2023
1 parent d7e905e commit 527453f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 527453f

Please sign in to comment.