diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-10-14 11:26:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 11:26:38 +0200 |
commit | 783f5e24b1c5f15f1d7e91f892051312a2a5c6c3 (patch) | |
tree | 5fb28f647c19338f2e5da37f7218d123cebc3fdb /src/op_mode/ipsec.py | |
parent | 02f2535dda08c6e19ba2e1fdb750f1e298b45add (diff) | |
parent | f089aa624e0713f117c949b74ec2ad389de2064e (diff) | |
download | vyos-1x-783f5e24b1c5f15f1d7e91f892051312a2a5c6c3.tar.gz vyos-1x-783f5e24b1c5f15f1d7e91f892051312a2a5c6c3.zip |
Merge pull request #1596 from sever-sever/T4725
T4725: Fix Regex for correctly reset IPsec peers
Diffstat (limited to 'src/op_mode/ipsec.py')
-rwxr-xr-x | src/op_mode/ipsec.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/op_mode/ipsec.py b/src/op_mode/ipsec.py index a4d1b4cb1..7ec35d7bd 100755 --- a/src/op_mode/ipsec.py +++ b/src/op_mode/ipsec.py @@ -133,14 +133,13 @@ def _get_formatted_output_sas(sas): def get_peer_connections(peer, tunnel, return_all = False): - peer = peer.replace(':', '-') - search = rf'^[\s]*(peer_{peer}_(tunnel_[\d]+|vti)).*' + search = rf'^[\s]*({peer}-(tunnel-[\d]+|vti)).*' 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 |