summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-12-09 16:08:57 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-03-07 12:02:37 -0600
commit337cf855431645f16f785c8b754138c7f2320b11 (patch)
tree15b9e95ce9bf6c3dc60c387bf9fabe8b1ad224a0
parentbdfd55a2847df1b130a74b50e83747d57b714532 (diff)
downloadvyos-1x-337cf855431645f16f785c8b754138c7f2320b11.tar.gz
vyos-1x-337cf855431645f16f785c8b754138c7f2320b11.zip
openvpn: T4872: fix parsing of tunnel IP in 'show openvpn server'
(cherry picked from commit 779f4001a4828f1af39a5b0b861d62635fcb3726)
-rwxr-xr-xsrc/op_mode/show_openvpn.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/op_mode/show_openvpn.py b/src/op_mode/show_openvpn.py
index 9a5adcffb..e29e594a5 100755
--- a/src/op_mode/show_openvpn.py
+++ b/src/op_mode/show_openvpn.py
@@ -59,7 +59,11 @@ def get_vpn_tunnel_address(peer, interface):
for line in lines:
if peer in line:
lst.append(line)
- tunnel_ip = lst[1].split(',')[0]
+
+ # filter out subnet entries
+ lst = [l for l in lst[1:] if '/' not in l.split(',')[0]]
+
+ tunnel_ip = lst[0].split(',')[0]
return tunnel_ip