diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-07-10 15:09:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-10 15:09:56 +0100 |
commit | b3681957a5120067ddb0cb9f162719e283d388e8 (patch) | |
tree | 245b81bfc37db0a27e354ea0c76d99b31c9340bf /src/op_mode/vpn_ipsec.py | |
parent | 483023e846c8aebfaebaa7293f03917095708fcd (diff) | |
parent | 12f956e66f6d557425a0071b384ccafa7e1e9a97 (diff) | |
download | vyos-1x-current.tar.gz vyos-1x-current.zip |
ipsec: T7545: Fix show vpn debug peer
Diffstat (limited to 'src/op_mode/vpn_ipsec.py')
-rwxr-xr-x | src/op_mode/vpn_ipsec.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/op_mode/vpn_ipsec.py b/src/op_mode/vpn_ipsec.py index b66ae6594..3d7049a14 100755 --- a/src/op_mode/vpn_ipsec.py +++ b/src/op_mode/vpn_ipsec.py @@ -23,13 +23,13 @@ SWANCTL_CONF = '/etc/swanctl/swanctl.conf' def get_peer_connections(peer, tunnel, return_all = False): - search = rf'^[\s]*(peer_{peer}_(tunnel_[\d]+|vti)).*' + search = rf'^[\s]*({peer}-(tunnel-[\d]+|vti))[\s]*{{' matches = [] with open(SWANCTL_CONF, 'r') as f: for line in f.readlines(): result = re.match(search, line) if result: - suffix = f'tunnel_{tunnel}' if tunnel.isnumeric() else tunnel + suffix = f'tunnel-{tunnel}' if tunnel.isnumeric() else tunnel if return_all or (result[2] == suffix): matches.append(result[1]) return matches @@ -66,7 +66,8 @@ def debug_peer(peer, tunnel): return for conn in conns: - call(f'/usr/sbin/ipsec statusall | grep {conn}') + command = f'/usr/sbin/ipsec statusall | grep {conn}' + call(command) if __name__ == '__main__': |