summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-12-03 01:29:38 +0100
committerDaniil Baturin <daniil@baturin.org>2018-12-03 01:29:38 +0100
commitf285e0cba6550b316794bf04f9992e9b471ea562 (patch)
treebc8e633f6adfb081a5da8138ae4ad6b7a94d4821
parenta29898b2ea15b7d9cea7fade1b27d38967c52d52 (diff)
downloadvyos-1x-f285e0cba6550b316794bf04f9992e9b471ea562.tar.gz
vyos-1x-f285e0cba6550b316794bf04f9992e9b471ea562.zip
T956: correct IKE proposal string parsing for SAs with non-zero counters.
-rwxr-xr-xsrc/op_mode/show_ipsec_sa.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/op_mode/show_ipsec_sa.py b/src/op_mode/show_ipsec_sa.py
index c0ef1feef..b03014b2f 100755
--- a/src/op_mode/show_ipsec_sa.py
+++ b/src/op_mode/show_ipsec_sa.py
@@ -10,11 +10,15 @@ def parse_conn_spec(s):
return re.search(r'.*ESTABLISHED\s+(.*)ago,\s(.*)\[(.*)\]\.\.\.(.*)\[(.*)\].*', s).groups()
def parse_ike_line(s):
- # Example: 3DES_CBC/HMAC_MD5_96/MODP_1024, 0 bytes_i, 0 bytes_o, rekeying in 45 minutes
try:
- return re.search(r'.*:\s+(.*)\/(.*)\/(.*),\s+(\d+)\s+bytes_i,\s+(\d+)\s+bytes_o,\s+rekeying', s).groups()
+ # Example with traffic: AES_CBC_256/HMAC_SHA2_256_128/ECP_521, 2382660 bytes_i (1789 pkts, 2s ago), 2382660 bytes_o ...
+ return re.search(r'.*:\s+(.*)\/(.*)\/(.*),\s+(\d+)\s+bytes_i\s\(.*pkts,.*\),\s+(\d+)\s+bytes_o', s).groups()
except AttributeError:
- return (None, None, None, None, None)
+ try:
+ # Example without traffic: 3DES_CBC/HMAC_MD5_96/MODP_1024, 0 bytes_i, 0 bytes_o, rekeying in 45 minutes
+ return re.search(r'.*:\s+(.*)\/(.*)\/(.*),\s+(\d+)\s+bytes_i,\s+(\d+)\s+bytes_o,\s+rekeying', s).groups()
+ except AttributeError:
+ return (None, None, None, None, None)
# Get a list of all configured connections