summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-19 22:27:50 +0200
committerChristian Poessinger <christian@poessinger.com>2020-05-19 22:27:50 +0200
commitf078e743c9c36b07a98d7ab433483cfca8ed2e0a (patch)
tree8e69bbbe54556042cf086e77742e537913954907 /src/conf_mode
parentbc060277ab553a1971054b4990a70c7476cae62f (diff)
downloadvyos-1x-f078e743c9c36b07a98d7ab433483cfca8ed2e0a.tar.gz
vyos-1x-f078e743c9c36b07a98d7ab433483cfca8ed2e0a.zip
wireguard: T2481: support IPv6 based underlay
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']: