summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-wireguard.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py
index 820b0a724..97dcf626b 100755
--- a/src/conf_mode/interfaces-wireguard.py
+++ b/src/conf_mode/interfaces-wireguard.py
@@ -25,7 +25,7 @@ from vyos.config import Config
from vyos.configdict import list_diff
from vyos.ifconfig import WireGuardIf
from vyos.util import chown, chmod_750, call
-from vyos.validate import is_member
+from vyos.validate import is_member, is_ipv6
from vyos import ConfigError
kdir = r'/config/auth/wireguard'
@@ -288,8 +288,10 @@ def apply(wg):
# endpoint
if peer['address'] and peer['port']:
- w.config['endpoint'] = '{}:{}'.format(
- peer['address'], peer['port'])
+ if is_ipv6(peer['address']):
+ w.config['endpoint'] = '[{}]:{}'.format(peer['address'], peer['port'])
+ else:
+ w.config['endpoint'] = '{}:{}'.format(peer['address'], peer['port'])
# persistent-keepalive
if peer['persistent_keepalive']: